#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(int, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reverse(char *);
int main() {
  char p[] = "12345";
  printf("\n%s", p);
  reverse(p);
  printf("\n%s", p);
  int num = -6789;
  itoa(num, p);
  printf("\n%d", num);
  printf("\n%s", p);
  printf("\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec2(%rip),%eax
mov    %eax,-0x6(%rbp)
mov    0xebc(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0x6(%rbp),%rsi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x6(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x6(%rbp),%rsi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffe57b,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x6(%rbp),%rsi
call   1050 <itoa@plt>
mov    -0xc(%rbp),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x6(%rbp),%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movw   $0x35,0x4(%rsp)
movl   $0x34333231,(%rsp)
lea    0xead(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffe57b,%edi
mov    %rbx,%rsi
call   1060 <itoa@plt>
lea    0xe78(%rip),%rdi
mov    $0xffffe57b,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe5c(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.p = [6 x i8] c"12345\00"
@.str = [4 x i8] c"\0A%s\00"
@.str.1 = [4 x i8] c"\0A%d\00"
@.str.2 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca i32
%3 = bitcast [6 x i8]* %1 to i8*
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%7 = call i32 @reverse(i8* %6)
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
store i32 -6789, i32* %2
%10 = load i32, i32* %2
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%12 = call i32 @itoa(i32 %10, i8* %11)
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.p = [6 x i8] c"12345\00"
@.str = [4 x i8] c"\0A%s\00"
@.str.1 = [4 x i8] c"\0A%d\00"
@str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @reverse(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%6 = call i32 @itoa(i32 -6789, i8* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 -6789)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}