#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 */
struct stat {
  int dummy;
};

/* Variables and functions */
int atoi(char *);
struct stat *malloc(int);
int /*<<< orphan*/ stat(char *, struct stat *);
int main(int argc, char *argv[]) {
  struct stat *st, sb;
  int i, total = argc > 1 ? atoi(argv[1]) : 1000;
  if (argc > 1) {
    st = malloc(sizeof(struct stat));
  } else {
    st = &sb;
  }
  for (i = 0; i < total; i++) {
    stat("./spec/ruby/1.8/core/true/and_spec.rb", st);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1165 <main+0x35>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x2c(%rbp)
jmp    1172 <main+0x42>
mov    $0x3e8,%eax
mov    %eax,-0x2c(%rbp)
jmp    1172 <main+0x42>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1195 <main+0x65>
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
jmp    119d <main+0x6d>
lea    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    11ce <main+0x9e>
mov    -0x18(%rbp),%rsi
lea    0xe45(%rip),%rdi
call   1030 <stat@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a4 <main+0x74>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jl     115c <main+0x2c>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %ebx,%ebx
jle    1180 <main+0x50>
mov    %rax,%r14
jmp    1166 <main+0x36>
mov    $0x3e8,%ebx
lea    0x8(%rsp),%r14
lea    0xe93(%rip),%r15
nopl   (%rax)
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <stat@plt>
add    $0xffffffff,%ebx
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [38 x i8] c"./spec/ruby/1.8/core/true/and_spec.rb\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat*
%7 = alloca %struct.stat
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
br label %18
17: ; preds = %2
br label %18
18: ; preds = %17, %12
%19 = phi i32 [ %16, %12 ], [ 1000, %17 ]
store i32 %19, i32* %9
%20 = load i32, i32* %4
%21 = icmp sgt i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call %struct.stat* @malloc(i32 4)
store %struct.stat* %23, %struct.stat** %6
br label %25
24: ; preds = %18
store %struct.stat* %7, %struct.stat** %6
br label %25
25: ; preds = %24, %22
store i32 0, i32* %8
br label %26
26: ; preds = %33, %25
%27 = load i32, i32* %8
%28 = load i32, i32* %9
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %36
30: ; preds = %26
%31 = load %struct.stat*, %struct.stat** %6
%32 = call i32 @stat(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), %struct.stat* %31)
br label %33
33: ; preds = %30
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %26
36: ; preds = %26
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [38 x i8] c"./spec/ruby/1.8/core/true/and_spec.rb\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = tail call %struct.stat* @malloc(i32 4)
%11 = icmp sgt i32 %9, 0
br i1 %11, label %12, label %20
12: ; preds = %2, %6
%13 = phi %struct.stat* [ %10, %6 ], [ %3, %2 ]
%14 = phi i32 [ %9, %6 ], [ 1000, %2 ]
br label %15
15: ; preds = %12, %15
%16 = phi i32 [ %18, %15 ], [ 0, %12 ]
%17 = call i32 @stat(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), %struct.stat* %13)
%18 = add nuw nsw i32 %16, 1
%19 = icmp eq i32 %18, %14
br i1 %19, label %20, label %15
20: ; preds = %15, %6
ret i32 0
}