#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 *, int);
int main() {
  char a[] = {'1', '0', '0', '2'};
  int r = 0;
  int i;
  int temp;
  for (i = 3; i >= 0; --i) {
    temp = atoi(a[i]);
    r = r * 10 + temp;
  }
  printf("%d ", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1179 <main+0x59>
movslq -0x10(%rbp),%rax
movsbl -0x8(%rbp,%rax,1),%edi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
imul   $0xa,-0xc(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <main+0x26>
mov    -0xc(%rbp),%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x32,%edi
call   1040 <atoi@plt>
mov    %eax,%ebx
mov    $0x30,%edi
call   1040 <atoi@plt>
lea    (%rbx,%rbx,4),%ecx
lea    (%rax,%rcx,2),%ebx
mov    $0x30,%edi
call   1040 <atoi@plt>
lea    (%rbx,%rbx,4),%ecx
lea    (%rax,%rcx,2),%ebx
mov    $0x31,%edi
call   1040 <atoi@plt>
lea    (%rbx,%rbx,4),%ecx
lea    (%rax,%rcx,2),%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [4 x i8] c"1002"
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [4 x i8]* %2 to i8*
store i32 0, i32* %3
store i32 3, i32* %4
br label %7
7: ; preds = %20, %0
%8 = load i32, i32* %4
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %7
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = call i32 @atoi(i8 signext %14)
store i32 %15, i32* %5
%16 = load i32, i32* %3
%17 = mul nsw i32 %16, 10
%18 = load i32, i32* %5
%19 = add nsw i32 %17, %18
store i32 %19, i32* %3
br label %20
20: ; preds = %10
%21 = load i32, i32* %4
%22 = add nsw i32 %21, -1
store i32 %22, i32* %4
br label %7
23: ; preds = %7
%24 = load i32, i32* %3
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = tail call i32 @atoi(i8 signext 50)
%2 = tail call i32 @atoi(i8 signext 48)
%3 = mul nsw i32 %1, 10
%4 = add nsw i32 %2, %3
%5 = tail call i32 @atoi(i8 signext 48)
%6 = mul nsw i32 %4, 10
%7 = add nsw i32 %5, %6
%8 = tail call i32 @atoi(i8 signext 49)
%9 = mul nsw i32 %7, 10
%10 = add nsw i32 %8, %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}