#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 */
typedef int /*<<< orphan*/ str;

/* Variables and functions */
int parseInt(char *);
int /*<<< orphan*/ printf(char *, char *, int);
void testParseInt() {
  int i, len;
  char *str[] = {"0", "1", "3", "10", "13", "199", "2000", "23031"};
  len = sizeof(str) / sizeof(str[0]);
  for (i = 0; i < len; i++)
    printf("\"%s\" -> %d\n", str[i], parseInt(str[i]));
}


x86 assembly (clang, -O0):
<testParseInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x50(%rbp),%rdi
lea    0x2c9d(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
movl   $0x8,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a2 <testParseInt+0x72>
movslq -0x4(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    %rax,-0x58(%rbp)
movslq -0x4(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
call   1030 <parseInt@plt>
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115b <testParseInt+0x2b>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testParseInt>:
push   %r14
push   %rbx
push   %rax
lea    0xee2(%rip),%rbx
mov    %rbx,%rdi
call   1030 <parseInt@plt>
lea    0xedb(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
call   1030 <parseInt@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe9a(%rip),%rbx
mov    %rbx,%rdi
call   1030 <parseInt@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe7a(%rip),%rbx
mov    %rbx,%rdi
call   1030 <parseInt@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe61(%rip),%rbx
mov    %rbx,%rdi
call   1030 <parseInt@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe48(%rip),%rbx
mov    %rbx,%rdi
call   1030 <parseInt@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe30(%rip),%rbx
mov    %rbx,%rdi
call   1030 <parseInt@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xe19(%rip),%rbx
mov    %rbx,%rdi
call   1030 <parseInt@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"3\00"
@.str.3 = [3 x i8] c"10\00"
@.str.4 = [3 x i8] c"13\00"
@.str.5 = [4 x i8] c"199\00"
@.str.6 = [5 x i8] c"2000\00"
@.str.7 = [6 x i8] c"23031\00"
@__const.testParseInt.str = [8 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i32 0, i32 0)]
@.str.8 = [12 x i8] c"\22%s\22 -> %d\0A\00"
define void @testParseInt() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [8 x i8*]
%4 = bitcast [8 x i8*]* %3 to i8*
store i32 8, i32* %2
store i32 0, i32* %1
br label %5
5: ; preds = %20, %0
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = load i32, i32* %1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [8 x i8*], [8 x i8*]* %3, i64 0, i64 %11
%13 = load i8*, i8** %12
%14 = load i32, i32* %1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [8 x i8*], [8 x i8*]* %3, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @parseInt(i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %13, i32 %18)
br label %20
20: ; preds = %9
%21 = load i32, i32* %1
%22 = add nsw i32 %21, 1
store i32 %22, i32* %1
br label %5
23: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"3\00"
@.str.3 = [3 x i8] c"10\00"
@.str.4 = [3 x i8] c"13\00"
@.str.5 = [4 x i8] c"199\00"
@.str.6 = [5 x i8] c"2000\00"
@.str.7 = [6 x i8] c"23031\00"
@.str.8 = [12 x i8] c"\22%s\22 -> %d\0A\00"
define void @testParseInt() {
%1 = tail call i32 @parseInt(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @parseInt(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @parseInt(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @parseInt(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @parseInt(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%10 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = tail call i32 @parseInt(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%12 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %11)
%13 = tail call i32 @parseInt(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%14 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%15 = tail call i32 @parseInt(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%16 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %15)
ret void
}