#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*/ emit_code(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ make_ff();
int /*<<< orphan*/ make_primes();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *opt = argc > 1 ? argv[1] : NULL;
  make_primes();
  make_ff();
  if (!opt)
    emit_code(0);
  else if (!strcmp(opt, "h") || !strcmp(opt, ".h") || !strcmp(opt, "-h"))
    emit_code(1);
  else if (!strcmp(opt, "c") || !strcmp(opt, ".c") || !strcmp(opt, "-c"))
    emit_code(0);
  else {
    fprintf(stderr, "Usage: ffgen [-h|-c]\n");
    fprintf(stderr, "  -h for header file\n");
    fprintf(stderr, "  -c for C source file\n");
    return 1;
  }
  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)
cmpl   $0x1,-0x8(%rbp)
jle    1181 <main+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    118c <main+0x3c>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    118c <main+0x3c>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1070 <make_primes@plt>
mov    $0x0,%al
call   1060 <make_ff@plt>
cmpq   $0x0,-0x18(%rbp)
jne    11b9 <main+0x69>
xor    %edi,%edi
call   1030 <emit_code@plt>
jmp    12bf <main+0x16f>
mov    -0x18(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     1204 <main+0xb4>
mov    -0x18(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     1204 <main+0xb4>
mov    -0x18(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1213 <main+0xc3>
mov    $0x1,%edi
call   1030 <emit_code@plt>
jmp    12ba <main+0x16a>
mov    -0x18(%rbp),%rdi
lea    0xdec(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     125e <main+0x10e>
mov    -0x18(%rbp),%rdi
lea    0xdcf(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     125e <main+0x10e>
mov    -0x18(%rbp),%rdi
lea    0xdb9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    126a <main+0x11a>
xor    %edi,%edi
call   1030 <emit_code@plt>
jmp    12b5 <main+0x165>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
lea    0xd92(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
lea    0xd93(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
lea    0xd94(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12c6 <main+0x176>
jmp    12ba <main+0x16a>
jmp    12bf <main+0x16f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     115e <main+0xe>
mov    0x8(%rsi),%rbx
jmp    1160 <main+0x10>
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   1070 <make_primes@plt>
xor    %eax,%eax
call   1060 <make_ff@plt>
test   %rbx,%rbx
je     123b <main+0xeb>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     122b <main+0xdb>
lea    0xe69(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     122b <main+0xdb>
lea    0xe55(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     122b <main+0xdb>
lea    0xe49(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1239 <main+0xe9>
lea    0xe32(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1239 <main+0xe9>
lea    0xe22(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1239 <main+0xe9>
mov    0x2de6(%rip),%rbx
mov    (%rbx),%edi
lea    0xe09(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe11(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe19(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%ebp
jmp    1242 <main+0xf2>
mov    $0x1,%edi
call   1030 <emit_code@plt>
xor    %ebp,%ebp
jmp    1242 <main+0xf2>
xor    %ebp,%ebp
xor    %edi,%edi
call   1030 <emit_code@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"h\00"
@.str.1 = [3 x i8] c".h\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [2 x i8] c"c\00"
@.str.4 = [3 x i8] c".c\00"
@.str.5 = [3 x i8] c"-c\00"
@stderr = global i32 0
@.str.6 = [22 x i8] c"Usage: ffgen [-h|-c]\0A\00"
@.str.7 = [22 x i8] c" -h for header file\0A\00"
@.str.8 = [24 x i8] c" -c for C source file\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
br label %14
13: ; preds = %2
br label %14
14: ; preds = %13, %9
%15 = phi i8* [ %12, %9 ], [ null, %13 ]
store i8* %15, i8** %6
%16 = call i32 (...) @make_primes()
%17 = call i32 (...) @make_ff()
%18 = load i8*, i8** %6
%19 = icmp ne i8* %18, null
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = call i32 @emit_code(i32 0)
br label %59
22: ; preds = %14
%23 = load i8*, i8** %6
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = load i8*, i8** %6
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = load i8*, i8** %6
%32 = call i32 @strcmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %30, %26, %22
%35 = call i32 @emit_code(i32 1)
br label %58
36: ; preds = %30
%37 = load i8*, i8** %6
%38 = call i32 @strcmp(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %48
40: ; preds = %36
%41 = load i8*, i8** %6
%42 = call i32 @strcmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %40
%45 = load i8*, i8** %6
%46 = call i32 @strcmp(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%47 = icmp ne i32 %46, 0
br i1 %47, label %50, label %48
48: ; preds = %44, %40, %36
%49 = call i32 @emit_code(i32 0)
br label %57
50: ; preds = %44
%51 = load i32, i32* @stderr
%52 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%53 = load i32, i32* @stderr
%54 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%55 = load i32, i32* @stderr
%56 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %60
57: ; preds = %48
br label %58
58: ; preds = %57, %34
br label %59
59: ; preds = %58, %20
store i32 0, i32* %3
br label %60
60: ; preds = %59, %50
%61 = load i32, i32* %3
ret i32 %61
}

LLVM IR (-O2):
@.str = [2 x i8] c"h\00"
@.str.1 = [3 x i8] c".h\00"
@.str.2 = [3 x i8] c"-h\00"
@.str.3 = [2 x i8] c"c\00"
@.str.4 = [3 x i8] c".c\00"
@.str.5 = [3 x i8] c"-c\00"
@stderr = global i32 0
@.str.6 = [22 x i8] c"Usage: ffgen [-h|-c]\0A\00"
@.str.7 = [22 x i8] c" -h for header file\0A\00"
@.str.8 = [24 x i8] c" -c for C source file\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
br label %7
7: ; preds = %2, %4
%8 = phi i8* [ %6, %4 ], [ null, %2 ]
%9 = tail call i32 (...) @make_primes()
%10 = tail call i32 (...) @make_ff()
%11 = icmp eq i8* %8, null
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @emit_code(i32 0)
br label %43
14: ; preds = %7
%15 = tail call i32 @strcmp(i8* %8, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = tail call i32 @strcmp(i8* %8, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = tail call i32 @strcmp(i8* %8, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20, %17, %14
%24 = tail call i32 @emit_code(i32 1)
br label %43
25: ; preds = %20
%26 = tail call i32 @strcmp(i8* %8, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %34, label %28
28: ; preds = %25
%29 = tail call i32 @strcmp(i8* %8, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = tail call i32 @strcmp(i8* %8, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31, %28, %25
%35 = tail call i32 @emit_code(i32 0)
br label %43
36: ; preds = %31
%37 = load i32, i32* @stderr
%38 = tail call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%39 = load i32, i32* @stderr
%40 = tail call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%41 = load i32, i32* @stderr
%42 = tail call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
br label %43
43: ; preds = %12, %34, %23, %36
%44 = phi i32 [ 1, %36 ], [ 0, %23 ], [ 0, %34 ], [ 0, %12 ]
ret i32 %44
}