#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*/ printf(char *, int);
int scan(char *);
int main(int argc, char **argv) {
  int n = 0;
  char *largv[4];
  if (argc < 2) {
    argc = 4;
    argv = largv;
    argv[1] = "";
    argv[2] = "1\n\n";
    argv[3] = "1\n2\n";
  }
  while (++n < argc) {
    printf("%d\n", scan(argv[n]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1183 <main+0x63>
movl   $0x4,-0x8(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xea2(%rip),%rcx
mov    %rcx,0x8(%rax)
mov    -0x10(%rbp),%rax
lea    0xe90(%rip),%rcx
mov    %rcx,0x10(%rax)
mov    -0x10(%rbp),%rax
lea    0xe85(%rip),%rcx
mov    %rcx,0x18(%rax)
jmp    1188 <main+0x68>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmp    -0x8(%rbp),%eax
jge    11be <main+0x9e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <scan@plt>
mov    %eax,%esi
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
jmp    1188 <main+0x68>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r15
cmp    $0x1,%edi
jg     115f <main+0x3f>
mov    %rsp,%r15
lea    0xec6(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xeb7(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xeaf(%rip),%rax
mov    %rax,0x18(%rsp)
mov    $0x4,%edi
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xe9b(%rip),%r14
xchg   %ax,%ax
mov    (%r15,%rbx,8),%rdi
call   1040 <scan@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1170 <main+0x50>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"1\0A\0A\00"
@.str.2 = [5 x i8] c"1\0A2\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [4 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %18
10: ; preds = %2
store i32 4, i32* %4
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 0
store i8** %11, i8*** %5
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %13
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %15
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %17
br label %18
18: ; preds = %10, %2
br label %19
19: ; preds = %24, %18
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
%22 = load i32, i32* %4
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %32
24: ; preds = %19
%25 = load i8**, i8*** %5
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 @scan(i8* %29)
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %30)
br label %19
32: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"1\0A\0A\00"
@.str.2 = [5 x i8] c"1\0A2\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4 x i8*]
%4 = bitcast [4 x i8*]* %3 to i8*
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%8 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 3
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %10
br label %11
11: ; preds = %2, %6
%12 = phi i32 [ 4, %6 ], [ %0, %2 ]
%13 = phi i8** [ %7, %6 ], [ %1, %2 ]
%14 = zext i32 %12 to i64
br label %15
15: ; preds = %11, %15
%16 = phi i64 [ 1, %11 ], [ %21, %15 ]
%17 = getelementptr inbounds i8*, i8** %13, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i32 @scan(i8* %18)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = add nuw nsw i64 %16, 1
%22 = icmp eq i64 %21, %14
br i1 %22, label %23, label %15
23: ; preds = %15
ret i32 0
}