#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*/ itoa(char, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *);
int main(void) {
  int ret = 0;
  char n[] = {-128, -1, 0, -127, 127}, i = 0;
  char s[12 + 1];
  while (i < 5) {
    itoa(n[i], s);
    reverse(s);
    printf("\n The value of the number is %s\n", s);
    i++;
  }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0xeb4(%rip),%eax
mov    %eax,-0xd(%rbp)
mov    0xeaf(%rip),%al
mov    %al,-0x9(%rbp)
movb   $0x0,-0xe(%rbp)
movsbl -0xe(%rbp),%eax
cmp    $0x5,%eax
jge    11a4 <main+0x74>
movsbq -0xe(%rbp),%rax
mov    -0xd(%rbp,%rax,1),%al
lea    -0x1b(%rbp),%rsi
movsbl %al,%edi
call   1050 <itoa@plt>
lea    -0x1b(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x1b(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
mov    -0xe(%rbp),%al
add    $0x1,%al
mov    %al,-0xe(%rbp)
jmp    115c <main+0x2c>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xb(%rsp),%rbx
mov    $0xffffff80,%edi
mov    %rbx,%rsi
call   1050 <itoa@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
lea    0xea8(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1050 <itoa@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <itoa@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0xffffff81,%edi
mov    %rbx,%rsi
call   1050 <itoa@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0x7f,%edi
mov    %rbx,%rsi
call   1050 <itoa@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.n = [5 x i8] c"\80\FF\00\81\7F"
@.str = [33 x i8] c"\0A The value of the number is %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x i8]
%4 = alloca i8
%5 = alloca [13 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
%6 = bitcast [5 x i8]* %3 to i8*
store i8 0, i8* %4
br label %7
7: ; preds = %11, %0
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i8, i8* %4
%13 = sext i8 %12 to i64
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 0
%17 = call i32 @itoa(i8 signext %15, i8* %16)
%18 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 0
%19 = call i32 @reverse(i8* %18)
%20 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = load i8, i8* %4
%23 = add i8 %22, 1
store i8 %23, i8* %4
br label %7
24: ; preds = %7
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [33 x i8] c"\0A The value of the number is %s\0A\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%3 = call i32 @itoa(i8 signext -128, i8* %2)
%4 = call i32 @reverse(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %2)
%6 = call i32 @itoa(i8 signext -1, i8* %2)
%7 = call i32 @reverse(i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = call i32 @itoa(i8 signext 0, i8* %2)
%10 = call i32 @reverse(i8* %2)
%11 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %2)
%12 = call i32 @itoa(i8 signext -127, i8* %2)
%13 = call i32 @reverse(i8* %2)
%14 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %2)
%15 = call i32 @itoa(i8 signext 127, i8* %2)
%16 = call i32 @reverse(i8* %2)
%17 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}