#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*/ generate();
int /*<<< orphan*/ paramdump();
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char *argv[]) {
  int i;
  int gen = 0;
  int param = 0;
  for (i = 1; i < argc; i++) {
    if (strncmp(argv[1], "-g", 2) == 0) {
      gen = 1;
    }
    if (strncmp(argv[1], "-p", 2) == 0) {
      param = 1;
    }
  }
  if (gen + param == 0) {
    printf("usage:\n%s [-g | -p]\n", argv[0]);
    return 0;
  }
  if (gen) {
    generate();
  }
  if (param) {
    paramdump();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11de <main+0x9e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7a(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a1 <main+0x61>
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe53(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11cb <main+0x8b>
movl   $0x1,-0x1c(%rbp)
jmp    11d0 <main+0x90>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116b <main+0x2b>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    $0x0,%eax
jne    120c <main+0xcc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe0b(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1235 <main+0xf5>
cmpl   $0x0,-0x18(%rbp)
je     121d <main+0xdd>
mov    $0x0,%al
call   1060 <generate@plt>
cmpl   $0x0,-0x1c(%rbp)
je     122e <main+0xee>
mov    $0x0,%al
call   1040 <paramdump@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
cmp    $0x2,%edi
jl     11b2 <main+0x72>
mov    %edi,%ebp
add    $0xffffffff,%ebp
xor    %r13d,%r13d
mov    $0x1,%r14d
lea    0xe9b(%rip),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x8(%r12),%rdi
lea    0xe84(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
cmove  %r14d,%ebx
mov    0x8(%r12),%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
cmove  %r14d,%r13d
add    $0xffffffff,%ebp
jne    1170 <main+0x30>
mov    %ebx,%eax
add    %r13d,%eax
jne    11d3 <main+0x93>
mov    (%r12),%rsi
lea    0xe49(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %ebx,%ebx
je     11de <main+0x9e>
xor    %eax,%eax
call   1060 <generate@plt>
test   %r13d,%r13d
je     11c2 <main+0x82>
xor    %eax,%eax
call   1040 <paramdump@plt>
jmp    11c2 <main+0x82>

LLVM IR (-O0):
@.str = [3 x i8] c"-g\00"
@.str.1 = [3 x i8] c"-p\00"
@.str.2 = [21 x i8] c"usage:\0A%s [-g | -p]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
store i32 1, i32* %6
br label %9
9: ; preds = %28, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %31
13: ; preds = %9
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strncmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 1, i32* %7
br label %20
20: ; preds = %19, %13
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %20
store i32 1, i32* %8
br label %27
27: ; preds = %26, %20
br label %28
28: ; preds = %27
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %9
31: ; preds = %9
%32 = load i32, i32* %7
%33 = load i32, i32* %8
%34 = add nsw i32 %32, %33
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %31
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %39)
store i32 0, i32* %3
br label %52
41: ; preds = %31
%42 = load i32, i32* %7
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 (...) @generate()
br label %46
46: ; preds = %44, %41
%47 = load i32, i32* %8
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 (...) @paramdump()
br label %51
51: ; preds = %49, %46
store i32 0, i32* %3
br label %52
52: ; preds = %51, %36
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@.str = [3 x i8] c"-g\00"
@.str.1 = [3 x i8] c"-p\00"
@.str.2 = [21 x i8] c"usage:\0A%s [-g | -p]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %23
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ 0, %4 ], [ %17, %6 ]
%8 = phi i32 [ 0, %4 ], [ %13, %6 ]
%9 = phi i32 [ 1, %4 ], [ %18, %6 ]
%10 = load i8*, i8** %5
%11 = tail call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i32 1, i32 %8
%14 = load i8*, i8** %5
%15 = tail call i64 @strncmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i32 1, i32 %7
%18 = add nuw nsw i32 %9, 1
%19 = icmp eq i32 %18, %0
br i1 %19, label %20, label %6
20: ; preds = %6
%21 = sub i32 0, %17
%22 = icmp eq i32 %13, %21
br i1 %22, label %23, label %26
23: ; preds = %2, %20
%24 = load i8*, i8** %1
%25 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %34
26: ; preds = %20
%27 = icmp eq i32 %13, 0
br i1 %27, label %30, label %28
28: ; preds = %26
%29 = tail call i32 (...) @generate()
br label %30
30: ; preds = %28, %26
%31 = icmp eq i32 %17, 0
br i1 %31, label %34, label %32
32: ; preds = %30
%33 = tail call i32 (...) @paramdump()
br label %34
34: ; preds = %30, %32, %23
ret i32 0
}