<commit_before>;******************************************************************************;
;                                                                              ;
;                                                         :::      ::::::::    ;
;    ft_putstr.s                                        :+:      :+:    :+:    ;
;                                                     +:+ +:+         +:+      ;
;    By: jlagneau <<EMAIL>>          +#+  +:+       +#+         ;
;                                                 +#+#+#+#+#+   +#+            ;
;    Created: 2017/03/21 19:48:24 by jlagneau          #+#    #+#              ;
;    Updated: 2017/03/22 15:19:49 by jlagneau         ###   ########.fr        ;
;                                                                              ;
;******************************************************************************;

%include "define/define.s"
%include "define/macro.s"

section     .text
    global  sym(ft_putstr)      ; int       ft_putstr(char *)
    extern  sym(ft_strlen)      ; size_t    ft_strlen(char *)

sym(ft_putstr):
    mov     rsi, rdi            ; put the string at rdi into rsi

    call    sym(ft_strlen)      ; put rdi string's length into rax
    mov     rdx, rax            ; store the length in rdx

    cmp     rax, 0              ; if parameter is NULL
    je      .end                ; return 0

    s_write STDOUT, rsi, rdx

    cmp     rax, 0              ; if rax < 0
    jnae    .end                ; return rax error

    mov     rax, rdx            ; store the length into rax for return

.end:<commit_msg>Fix ft_putstr return value<commit_after>;******************************************************************************;
;                                                                              ;
;                                                         :::      ::::::::    ;
;    ft_putstr.s                                        :+:      :+:    :+:    ;
;                                                     +:+ +:+         +:+      ;
;    By: jlagneau <<EMAIL>>          +#+  +:+       +#+         ;
;                                                 +#+#+#+#+#+   +#+            ;
;    Created: 2017/03/21 19:48:24 by jlagneau          #+#    #+#              ;
;    Updated: 2017/03/22 17:15:13 by jlagneau         ###   ########.fr        ;
;                                                                              ;
;******************************************************************************;

%include "define/define.s"
%include "define/macro.s"

section     .text
    global  sym(ft_putstr)      ; int       ft_putstr(char *)
    extern  sym(ft_strlen)      ; size_t    ft_strlen(char *)

sym(ft_putstr):
    mov     rsi, rdi            ; put the string at rdi into rsi

    call    sym(ft_strlen)      ; put rdi string's length into rax
    mov     rdx, rax            ; store the length in rdx
    mov     rbx, rax            ; store the length in rbx

    cmp     rax, 0              ; if parameter is NULL
    je      .end                ; return 0


    s_write STDOUT, rsi, rdx

    cmp     rax, 0              ; if rax < 0
    jnae    .end                ; return rax error

    mov     rax, rbx            ; store the length into rax for return

.end:
{'fraction_non_alphanumeric': 0.19235436893203883, 'fraction_numerical': 0.019417475728155338, 'mean_word_length': 0.9474305965741288, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '714725', 'n_tokens_mistral': 915, 'n_tokens_neox': 821, 'n_words': 198}