#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 mymain(int l, int R, int k, const char **defines, int ndefines,
           const char *outfile, int v, const char **infiles, int ninfiles) {
  int i;
  if (l > 0)
    printf("list files (-l)\n");
  if (R > 0)
    printf("recurse through directories (-R)\n");
  if (v > 0)
    printf("verbose is enabled (-v)\n");
  printf("scalar k=%d\n", k);
  printf("output is \"%s\"\n", outfile);
  for (i = 0; i < ndefines; i++)
    printf("user defined macro \"%s\"\n", defines[i]);
  for (i = 0; i < ninfiles; i++)
    printf("infile[%d]=\"%s\"\n", i, infiles[i]);
  return 0;
}


x86 assembly (clang, -O0):
<mymain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    114f <mymain+0x3f>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1167 <mymain+0x57>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,0x10(%rbp)
jle    117f <mymain+0x6f>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11dd <mymain+0xcd>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11a9 <mymain+0x99>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    0x20(%rbp),%eax
jge    121b <mymain+0x10b>
mov    -0x2c(%rbp),%esi
mov    0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11e4 <mymain+0xd4>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mymain>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8d,%r12d
mov    %rcx,%r13
mov    %edx,%r15d
mov    %esi,%ebp
test   %edi,%edi
jle    1149 <mymain+0x29>
lea    0xf3c(%rip),%rdi
call   1030 <puts@plt>
mov    0x40(%rsp),%ebx
test   %ebp,%ebp
jle    115d <mymain+0x3d>
lea    0xf07(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    116d <mymain+0x4d>
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12d,%r12d
jle    11b8 <mymain+0x98>
mov    %r12d,%ebx
lea    0xe7f(%rip),%r14
xor    %ebp,%ebp
mov    0x0(%r13,%rbp,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11a0 <mymain+0x80>
mov    0x50(%rsp),%eax
test   %eax,%eax
jle    11e9 <mymain+0xc9>
mov    0x48(%rsp),%r14
mov    %eax,%ebx
lea    0xe68(%rip),%r15
xor    %ebp,%ebp
mov    (%r14,%rbp,8),%rdx
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11d0 <mymain+0xb0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"list files (-l)\0A\00"
@.str.1 = [34 x i8] c"recurse through directories (-R)\0A\00"
@.str.2 = [25 x i8] c"verbose is enabled (-v)\0A\00"
@.str.3 = [13 x i8] c"scalar k=%d\0A\00"
@.str.4 = [16 x i8] c"output is \22%s\22\0A\00"
@.str.5 = [25 x i8] c"user defined macro \22%s\22\0A\00"
@.str.6 = [17 x i8] c"infile[%d]=\22%s\22\0A\00"
define i32 @mymain(i32 %0, i32 %1, i32 %2, i8** %3, i32 %4, i8* %5, i32 %6, i8** %7, i32 %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8**
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i8**
%18 = alloca i32
%19 = alloca i32
store i32 %0, i32* %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store i8** %3, i8*** %13
store i32 %4, i32* %14
store i8* %5, i8** %15
store i32 %6, i32* %16
store i8** %7, i8*** %17
store i32 %8, i32* %18
%20 = load i32, i32* %10
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %9
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %9
%25 = load i32, i32* %11
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
%30 = load i32, i32* %16
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
%35 = load i32, i32* %12
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %35)
%37 = load i8*, i8** %15
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %37)
store i32 0, i32* %19
br label %39
39: ; preds = %50, %34
%40 = load i32, i32* %19
%41 = load i32, i32* %14
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %53
43: ; preds = %39
%44 = load i8**, i8*** %13
%45 = load i32, i32* %19
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %44, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %43
%51 = load i32, i32* %19
%52 = add nsw i32 %51, 1
store i32 %52, i32* %19
br label %39
53: ; preds = %39
store i32 0, i32* %19
br label %54
54: ; preds = %66, %53
%55 = load i32, i32* %19
%56 = load i32, i32* %18
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %69
58: ; preds = %54
%59 = load i32, i32* %19
%60 = load i8**, i8*** %17
%61 = load i32, i32* %19
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %60, i64 %62
%64 = load i8*, i8** %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %59, i8* %64)
br label %66
66: ; preds = %58
%67 = load i32, i32* %19
%68 = add nsw i32 %67, 1
store i32 %68, i32* %19
br label %54
69: ; preds = %54
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [13 x i8] c"scalar k=%d\0A\00"
@.str.4 = [16 x i8] c"output is \22%s\22\0A\00"
@.str.5 = [25 x i8] c"user defined macro \22%s\22\0A\00"
@.str.6 = [17 x i8] c"infile[%d]=\22%s\22\0A\00"
@str = [24 x i8] c"verbose is enabled (-v)\00"
@str.7 = [33 x i8] c"recurse through directories (-R)\00"
@str.8 = [16 x i8] c"list files (-l)\00"
define i32 @mymain(i32 %0, i32 %1, i32 %2, i8** nocapture %3, i32 %4, i8* %5, i32 %6, i8** nocapture %7, i32 %8) {
%10 = icmp sgt i32 %0, 0
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.8, i64 0, i64 0))
br label %13
13: ; preds = %11, %9
%14 = icmp sgt i32 %1, 0
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
%18 = icmp sgt i32 %6, 0
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %21
21: ; preds = %19, %17
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %2)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %5)
%24 = icmp sgt i32 %4, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = zext i32 %4 to i64
br label %31
27: ; preds = %31, %21
%28 = icmp sgt i32 %8, 0
br i1 %28, label %29, label %46
29: ; preds = %27
%30 = zext i32 %8 to i64
br label %38
31: ; preds = %25, %31
%32 = phi i64 [ 0, %25 ], [ %36, %31 ]
%33 = getelementptr inbounds i8*, i8** %3, i64 %32
%34 = load i8*, i8** %33
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %34)
%36 = add nuw nsw i64 %32, 1
%37 = icmp eq i64 %36, %26
br i1 %37, label %27, label %31
38: ; preds = %29, %38
%39 = phi i64 [ 0, %29 ], [ %44, %38 ]
%40 = getelementptr inbounds i8*, i8** %7, i64 %39
%41 = load i8*, i8** %40
%42 = trunc i64 %39 to i32
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %42, i8* %41)
%44 = add nuw nsw i64 %39, 1
%45 = icmp eq i64 %44, %30
br i1 %45, label %46, label %38
46: ; preds = %38, %27
ret i32 0
}