int test_ft_atoi() {
  char strs[9][15] = {"\t\n\v\f\r -042",
                      "    +007",
                      "07-4",
                      "00-7",
                      "-007",
                      "007",
                      "124",
                      "-235",
                      ".5"};
  int i;
  printf("%s\n", __func__ + 5);
  _it("should return the same as libc's atoi");
  i = 9;
  while (i--)
    do {
      _begin_assert();
      if (ft_atoi(strs[i]) != atoi(strs[i])) {
        _fail_test();
        do {
          _color(31);
          printf("\nfailure in %s() line %d\n", __func__, 38);
          _color(0);
        } while (0);
        printf("expected %i to equal %i\n\n", ft_atoi(strs[i]), atoi(strs[i]));
        return 1;
      }
    } while (0);
  do {
    _close_pending();
    printf("\n");
    return (0);
  } while (0);
}


x86 assembly (clang, -O0):
<test_ft_atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    -0x90(%rbp),%rdi
lea    0xe57(%rip),%rsi
mov    $0x87,%edx
call   1060 <memcpy@plt>
lea    0xecd(%rip),%rdi
lea    0xeca(%rip),%rsi
add    $0x5,%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1080 <_it@plt>
movl   $0x9,-0x94(%rbp)
mov    -0x94(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x94(%rbp)
cmp    $0x0,%eax
je     12f8 <test_ft_atoi+0x168>
jmp    1203 <test_ft_atoi+0x73>
mov    $0x0,%al
call   1030 <_begin_assert@plt>
movslq -0x94(%rbp),%rax
lea    -0x90(%rbp),%rdi
imul   $0xf,%rax,%rax
add    %rax,%rdi
mov    $0x0,%al
call   10b0 <ft_atoi@plt>
mov    %eax,-0x98(%rbp)
movslq -0x94(%rbp),%rax
lea    -0x90(%rbp),%rdi
imul   $0xf,%rax,%rax
add    %rax,%rdi
mov    $0x0,%al
call   10a0 <atoi@plt>
mov    %eax,%ecx
mov    -0x98(%rbp),%eax
cmp    %ecx,%eax
je     12ee <test_ft_atoi+0x15e>
mov    $0x0,%al
call   1090 <_fail_test@plt>
mov    $0x1f,%edi
mov    $0x0,%al
call   1070 <_color@plt>
lea    0xe4c(%rip),%rdi
lea    0xe12(%rip),%rsi
mov    $0x26,%edx
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x0,%al
call   1070 <_color@plt>
movslq -0x94(%rbp),%rax
lea    -0x90(%rbp),%rdi
imul   $0xf,%rax,%rax
add    %rax,%rdi
mov    $0x0,%al
call   10b0 <ft_atoi@plt>
mov    %eax,-0x9c(%rbp)
movslq -0x94(%rbp),%rax
lea    -0x90(%rbp),%rdi
imul   $0xf,%rax,%rax
add    %rax,%rdi
mov    $0x0,%al
call   10a0 <atoi@plt>
mov    -0x9c(%rbp),%esi
mov    %eax,%edx
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1319 <test_ft_atoi+0x189>
jmp    12f3 <test_ft_atoi+0x163>
jmp    11e4 <test_ft_atoi+0x54>
jmp    12fd <test_ft_atoi+0x16d>
mov    $0x0,%al
call   1040 <_close_pending@plt>
lea    0xde5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ft_atoi>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
lea    0xe3c(%rip),%rsi
mov    %rsp,%r14
mov    $0x87,%edx
mov    %r14,%rdi
call   1080 <memcpy@plt>
lea    0xeb1(%rip),%rdi
call   1050 <puts@plt>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   10a0 <_it@plt>
xor    %eax,%eax
call   1040 <_begin_assert@plt>
lea    0x78(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10d0 <ft_atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
cmp    %eax,%ebp
jne    1371 <test_ft_atoi+0x1c1>
xor    %eax,%eax
call   1040 <_begin_assert@plt>
lea    0x69(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10d0 <ft_atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
cmp    %eax,%ebp
jne    1371 <test_ft_atoi+0x1c1>
xor    %eax,%eax
call   1040 <_begin_assert@plt>
lea    0x5a(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10d0 <ft_atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
cmp    %eax,%ebp
jne    1371 <test_ft_atoi+0x1c1>
xor    %eax,%eax
call   1040 <_begin_assert@plt>
lea    0x4b(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10d0 <ft_atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
cmp    %eax,%ebp
jne    1371 <test_ft_atoi+0x1c1>
xor    %eax,%eax
call   1040 <_begin_assert@plt>
lea    0x3c(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10d0 <ft_atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
cmp    %eax,%ebp
jne    1371 <test_ft_atoi+0x1c1>
xor    %eax,%eax
call   1040 <_begin_assert@plt>
lea    0x2d(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10d0 <ft_atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
cmp    %eax,%ebp
jne    1371 <test_ft_atoi+0x1c1>
xor    %eax,%eax
call   1040 <_begin_assert@plt>
lea    0x1e(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10d0 <ft_atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
cmp    %eax,%ebp
jne    1371 <test_ft_atoi+0x1c1>
xor    %eax,%eax
call   1040 <_begin_assert@plt>
lea    0xf(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   10d0 <ft_atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
cmp    %eax,%ebp
jne    1371 <test_ft_atoi+0x1c1>
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <_begin_assert@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   10d0 <ft_atoi@plt>
mov    %eax,%r15d
mov    %r14,%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
mov    %r14,%rbx
cmp    %eax,%r15d
jne    1371 <test_ft_atoi+0x1c1>
xor    %eax,%eax
call   1060 <_close_pending@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    13d4 <test_ft_atoi+0x224>
xor    %eax,%eax
call   10b0 <_fail_test@plt>
mov    $0x1f,%edi
xor    %eax,%eax
call   1090 <_color@plt>
lea    0xd2f(%rip),%rdi
lea    0xcf5(%rip),%rsi
mov    $0x26,%edx
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
xor    %eax,%eax
call   1090 <_color@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   10d0 <ft_atoi@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
lea    0xd10(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.test_ft_atoi.strs = [9 x [15 x i8]] [[15 x i8] c"\09\0A\0B\0C\0D -042\00\00\00\00\00", [15 x i8] c" +007\00\00\00\00\00\00\00", [15 x i8] c"07-4\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c"00-7\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c"-007\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c"007\00\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c"124\00\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c"-235\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c".5\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@.str = [4 x i8] c"%s\0A\00"
@__func__.test_ft_atoi = [13 x i8] c"test_ft_atoi\00"
@.str.1 = [38 x i8] c"should return the same as libc's atoi\00"
@.str.2 = [26 x i8] c"\0Afailure in %s() line %d\0A\00"
@.str.3 = [26 x i8] c"expected %i to equal %i\0A\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @test_ft_atoi() {
%1 = alloca i32
%2 = alloca [9 x [15 x i8]]
%3 = alloca i32
%4 = bitcast [9 x [15 x i8]]* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.test_ft_atoi, i64 0, i64 5))
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @_it to i32 (i8*, ...)*)(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
store i32 9, i32* %3
br label %7
7: ; preds = %44, %0
%8 = load i32, i32* %3
%9 = add nsw i32 %8, -1
store i32 %9, i32* %3
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %45
11: ; preds = %7
br label %12
12: ; preds = %11
%13 = call i32 (...) @_begin_assert()
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %2, i64 0, i64 %15
%17 = getelementptr inbounds [15 x i8], [15 x i8]* %16, i64 0, i64 0
%18 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %17)
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %2, i64 0, i64 %20
%22 = getelementptr inbounds [15 x i8], [15 x i8]* %21, i64 0, i64 0
%23 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %22)
%24 = icmp ne i32 %18, %23
br i1 %24, label %25, label %43
25: ; preds = %12
%26 = call i32 (...) @_fail_test()
br label %27
27: ; preds = %25
%28 = call i32 (i32, ...) bitcast (i32 (...)* @_color to i32 (i32, ...)*)(i32 31)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.test_ft_atoi, i64 0, i64 0), i32 38)
%30 = call i32 (i32, ...) bitcast (i32 (...)* @_color to i32 (i32, ...)*)(i32 0)
br label %31
31: ; preds = %27
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %2, i64 0, i64 %33
%35 = getelementptr inbounds [15 x i8], [15 x i8]* %34, i64 0, i64 0
%36 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %35)
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %2, i64 0, i64 %38
%40 = getelementptr inbounds [15 x i8], [15 x i8]* %39, i64 0, i64 0
%41 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %36, i32 %41)
store i32 1, i32* %1
br label %49
43: ; preds = %12
br label %44
44: ; preds = %43
br label %7
45: ; preds = %7
br label %46
46: ; preds = %45
%47 = call i32 (...) @_close_pending()
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
br label %49
49: ; preds = %31, %46
%50 = load i32, i32* %1
ret i32 %50
}

LLVM IR (-O2):
@__const.test_ft_atoi.strs = [9 x [15 x i8]] [[15 x i8] c"\09\0A\0B\0C\0D -042\00\00\00\00\00", [15 x i8] c" +007\00\00\00\00\00\00\00", [15 x i8] c"07-4\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c"00-7\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c"-007\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c"007\00\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c"124\00\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c"-235\00\00\00\00\00\00\00\00\00\00\00", [15 x i8] c".5\00\00\00\00\00\00\00\00\00\00\00\00\00"]
@__func__.test_ft_atoi = [13 x i8] c"test_ft_atoi\00"
@.str.1 = [38 x i8] c"should return the same as libc's atoi\00"
@.str.2 = [26 x i8] c"\0Afailure in %s() line %d\0A\00"
@.str.3 = [26 x i8] c"expected %i to equal %i\0A\0A\00"
define i32 @test_ft_atoi() {
%1 = alloca [9 x [15 x i8]]
%2 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %1, i64 0, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.test_ft_atoi, i64 0, i64 5))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @_it to i32 (i8*, ...)*)(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @_begin_assert()
%6 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %1, i64 0, i64 8, i64 0
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %6)
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %6)
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %57
10: ; preds = %0
%11 = call i32 (...) @_begin_assert()
%12 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %1, i64 0, i64 7, i64 0
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %12)
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %12)
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %57
16: ; preds = %10
%17 = call i32 (...) @_begin_assert()
%18 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %1, i64 0, i64 6, i64 0
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %18)
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %18)
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %57
22: ; preds = %16
%23 = call i32 (...) @_begin_assert()
%24 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %1, i64 0, i64 5, i64 0
%25 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %24)
%26 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %24)
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %57
28: ; preds = %22
%29 = call i32 (...) @_begin_assert()
%30 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %1, i64 0, i64 4, i64 0
%31 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %30)
%32 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %30)
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %57
34: ; preds = %28
%35 = call i32 (...) @_begin_assert()
%36 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %1, i64 0, i64 3, i64 0
%37 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %36)
%38 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %36)
%39 = icmp eq i32 %37, %38
br i1 %39, label %40, label %57
40: ; preds = %34
%41 = call i32 (...) @_begin_assert()
%42 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %1, i64 0, i64 2, i64 0
%43 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %42)
%44 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %42)
%45 = icmp eq i32 %43, %44
br i1 %45, label %46, label %57
46: ; preds = %40
%47 = call i32 (...) @_begin_assert()
%48 = getelementptr inbounds [9 x [15 x i8]], [9 x [15 x i8]]* %1, i64 0, i64 1, i64 0
%49 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %48)
%50 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %48)
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %57
52: ; preds = %46
%53 = call i32 (...) @_begin_assert()
%54 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %2)
%55 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %2)
%56 = icmp eq i32 %54, %55
br i1 %56, label %66, label %57
57: ; preds = %52, %46, %40, %34, %28, %22, %16, %10, %0
%58 = phi i8* [ %6, %0 ], [ %12, %10 ], [ %18, %16 ], [ %24, %22 ], [ %30, %28 ], [ %36, %34 ], [ %42, %40 ], [ %48, %46 ], [ %2, %52 ]
%59 = call i32 (...) @_fail_test()
%60 = call i32 (i32, ...) bitcast (i32 (...)* @_color to i32 (i32, ...)*)(i32 31)
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.test_ft_atoi, i64 0, i64 0), i32 38)
%62 = call i32 (i32, ...) bitcast (i32 (...)* @_color to i32 (i32, ...)*)(i32 0)
%63 = call i32 (i8*, ...) bitcast (i32 (...)* @ft_atoi to i32 (i8*, ...)*)(i8* %58)
%64 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %58)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %63, i32 %64)
br label %69
66: ; preds = %52
%67 = call i32 (...) @_close_pending()
%68 = call i32 @putchar(i32 10)
br label %69
69: ; preds = %66, %57
%70 = phi i32 [ 1, %57 ], [ 0, %66 ]
ret i32 %70
}