#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 atoi(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int main() {
  int i;
  char buffer[256];
  for (i = 0; i < 256; i++)
    buffer[i] = '\0';
  buffer[0] = '1';
  buffer[1] = '0';
  i = atoi(buffer);
  printf("string: %s, int: %d\n", buffer, i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    1160 <main+0x40>
movslq -0x8(%rbp),%rax
movb   $0x0,-0x110(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
movb   $0x31,-0x110(%rbp)
movb   $0x30,-0x10f(%rbp)
lea    -0x110(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x8(%rbp)
lea    -0x110(%rbp),%rsi
mov    -0x8(%rbp),%edx
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movw   $0x3031,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <atoi@plt>
lea    0xe56(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"string: %s, int: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [256 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 256
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %9
store i8 0, i8* %10
br label %11
11: ; preds = %7
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %4
14: ; preds = %4
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
store i8 49, i8* %15
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 1
store i8 48, i8* %16
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %2
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%20 = load i32, i32* %2
%21 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %19, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"string: %s, int: %d\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
store i8 49, i8* %3
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 1
store i8 48, i8* %4
%5 = call i32 @atoi(i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %5)
ret i32 0
}