#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ _assert(int, char *, int);
int /*<<< orphan*/ itoa(int, char *);
int /*<<< orphan*/ puts(char *);
void test_itoa(void) {
  char s[12];
  puts("--- testing itoa\n");
  itoa(0, s);
  _assert((s[0] == '0'),
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/BSVC/bsvc/refs/heads/master/samples/"
          "m68360/gdb7/test7.c",
          98);
  _assert((s[1] == 0),
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/BSVC/bsvc/refs/heads/master/samples/"
          "m68360/gdb7/test7.c",
          99);
  itoa(1, s);
  _assert((s[0] == '1'),
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/BSVC/bsvc/refs/heads/master/samples/"
          "m68360/gdb7/test7.c",
          102);
  _assert((s[1] == 0),
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/BSVC/bsvc/refs/heads/master/samples/"
          "m68360/gdb7/test7.c",
          103);
  itoa(10, s);
  _assert((s[0] == '1'),
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/BSVC/bsvc/refs/heads/master/samples/"
          "m68360/gdb7/test7.c",
          106);
  _assert((s[1] == '0'),
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/BSVC/bsvc/refs/heads/master/samples/"
          "m68360/gdb7/test7.c",
          107);
  _assert((s[2] == 0),
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/BSVC/bsvc/refs/heads/master/samples/"
          "m68360/gdb7/test7.c",
          108);
}


x86 assembly (clang, -O0):
<test_itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    -0xc(%rbp),%rsi
xor    %edi,%edi
call   1050 <itoa@plt>
movsbl -0xc(%rbp),%eax
cmp    $0x30,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xead(%rip),%rsi
mov    $0x62,%edx
call   1040 <_assert@plt>
movsbl -0xb(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe8d(%rip),%rsi
mov    $0x63,%edx
call   1040 <_assert@plt>
lea    -0xc(%rbp),%rsi
mov    $0x1,%edi
call   1050 <itoa@plt>
movsbl -0xc(%rbp),%eax
cmp    $0x31,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe5f(%rip),%rsi
mov    $0x66,%edx
call   1040 <_assert@plt>
movsbl -0xb(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe3f(%rip),%rsi
mov    $0x67,%edx
call   1040 <_assert@plt>
lea    -0xc(%rbp),%rsi
mov    $0xa,%edi
call   1050 <itoa@plt>
movsbl -0xc(%rbp),%eax
cmp    $0x31,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe11(%rip),%rsi
mov    $0x6a,%edx
call   1040 <_assert@plt>
movsbl -0xb(%rbp),%eax
cmp    $0x30,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xdf1(%rip),%rsi
mov    $0x6b,%edx
call   1040 <_assert@plt>
movsbl -0xa(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xdd1(%rip),%rsi
mov    $0x6c,%edx
call   1040 <_assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_itoa>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%r14
xor    %edi,%edi
mov    %r14,%rsi
call   1050 <itoa@plt>
xor    %edi,%edi
cmpb   $0x30,0xc(%rsp)
sete   %dil
lea    0xeae(%rip),%rbx
mov    %rbx,%rsi
mov    $0x62,%edx
call   1040 <_assert@plt>
xor    %edi,%edi
cmpb   $0x0,0xd(%rsp)
sete   %dil
mov    %rbx,%rsi
mov    $0x63,%edx
call   1040 <_assert@plt>
mov    $0x1,%edi
mov    %r14,%rsi
call   1050 <itoa@plt>
xor    %edi,%edi
cmpb   $0x31,0xc(%rsp)
sete   %dil
mov    %rbx,%rsi
mov    $0x66,%edx
call   1040 <_assert@plt>
xor    %edi,%edi
cmpb   $0x0,0xd(%rsp)
sete   %dil
mov    %rbx,%rsi
mov    $0x67,%edx
call   1040 <_assert@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1050 <itoa@plt>
xor    %edi,%edi
cmpb   $0x31,0xc(%rsp)
sete   %dil
mov    %rbx,%rsi
mov    $0x6a,%edx
call   1040 <_assert@plt>
xor    %edi,%edi
cmpb   $0x30,0xd(%rsp)
sete   %dil
mov    %rbx,%rsi
mov    $0x6b,%edx
call   1040 <_assert@plt>
xor    %edi,%edi
cmpb   $0x0,0xe(%rsp)
sete   %dil
mov    %rbx,%rsi
mov    $0x6c,%edx
call   1040 <_assert@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"--- testing itoa\0A\00"
@.str.1 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BSVC/bsvc/refs/heads/master/samples/m68360/gdb7/test7.c\00"
define void @test_itoa() {
%1 = alloca [12 x i8]
%2 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%4 = call i32 @itoa(i32 0, i8* %3)
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 48
%9 = zext i1 %8 to i32
%10 = call i32 @_assert(i32 %9, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 98)
%11 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @_assert(i32 %15, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 99)
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%18 = call i32 @itoa(i32 1, i8* %17)
%19 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 49
%23 = zext i1 %22 to i32
%24 = call i32 @_assert(i32 %23, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 102)
%25 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @_assert(i32 %29, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 103)
%31 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%32 = call i32 @itoa(i32 10, i8* %31)
%33 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 49
%37 = zext i1 %36 to i32
%38 = call i32 @_assert(i32 %37, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 106)
%39 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 1
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 48
%43 = zext i1 %42 to i32
%44 = call i32 @_assert(i32 %43, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 107)
%45 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 2
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 0
%49 = zext i1 %48 to i32
%50 = call i32 @_assert(i32 %49, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 108)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"--- testing itoa\0A\00"
@.str.1 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/BSVC/bsvc/refs/heads/master/samples/m68360/gdb7/test7.c\00"
define void @test_itoa() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @itoa(i32 0, i8* %2)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 48
%7 = zext i1 %6 to i32
%8 = call i32 @_assert(i32 %7, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 98)
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @_assert(i32 %12, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 99)
%14 = call i32 @itoa(i32 1, i8* %2)
%15 = load i8, i8* %2
%16 = icmp eq i8 %15, 49
%17 = zext i1 %16 to i32
%18 = call i32 @_assert(i32 %17, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 102)
%19 = load i8, i8* %9
%20 = icmp eq i8 %19, 0
%21 = zext i1 %20 to i32
%22 = call i32 @_assert(i32 %21, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 103)
%23 = call i32 @itoa(i32 10, i8* %2)
%24 = load i8, i8* %2
%25 = icmp eq i8 %24, 49
%26 = zext i1 %25 to i32
%27 = call i32 @_assert(i32 %26, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 106)
%28 = load i8, i8* %9
%29 = icmp eq i8 %28, 48
%30 = zext i1 %29 to i32
%31 = call i32 @_assert(i32 %30, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 107)
%32 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 2
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
%35 = zext i1 %34 to i32
%36 = call i32 @_assert(i32 %35, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 108)
ret void
}