#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 calculate(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ get_pagesize();
int getopt(int, char **, char *);
int /*<<< orphan*/ init_log(int /*<<< orphan*/ *, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ usage(int);
int main(int argc, char **argv) {
  int ret, opt, verbose = 0, numerator = 0;
  while ((opt = getopt(argc, argv, "Avh")) > 0) {
    switch (opt) {
    case 'v':
      verbose = 1;
      break;
    case 'A':
      numerator = 1;
      break;
    case 'h':
      usage(0);
    default:
      usage(1);
    }
  }
  init_log(NULL, 0, 0, 0, 0, NULL);
  get_pagesize();
  ret = calculate(numerator, verbose);
  exit(ret);
}


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)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe6e(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jle    1207 <main+0xa7>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x41,%eax
je     11e5 <main+0x85>
jmp    11b7 <main+0x57>
mov    -0x24(%rbp),%eax
sub    $0x68,%eax
je     11f1 <main+0x91>
jmp    11c8 <main+0x68>
mov    -0x24(%rbp),%eax
sub    $0x76,%eax
jne    11f8 <main+0x98>
jmp    11d9 <main+0x79>
movl   $0x1,-0x1c(%rbp)
jmp    1202 <main+0xa2>
movl   $0x1,-0x20(%rbp)
jmp    1202 <main+0xa2>
xor    %edi,%edi
call   1050 <usage@plt>
mov    $0x1,%edi
call   1050 <usage@plt>
jmp    1184 <main+0x24>
xor    %eax,%eax
mov    %eax,%r9d
xor    %r8d,%r8d
mov    %r9,%rdi
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <init_log@plt>
mov    $0x0,%al
call   1040 <get_pagesize@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1030 <calculate@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe8c(%rip),%rdx
call   1070 <getopt@plt>
xor    %r15d,%r15d
mov    $0x0,%r14d
test   %eax,%eax
jle    11e8 <main+0x88>
xor    %r14d,%r14d
lea    0xe70(%rip),%r12
xor    %r15d,%r15d
jmp    11c2 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %edi,%edi
call   1050 <usage@plt>
mov    $0x1,%edi
call   1050 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1070 <getopt@plt>
test   %eax,%eax
jle    11e8 <main+0x88>
cmp    $0x76,%eax
je     11e0 <main+0x80>
cmp    $0x68,%eax
je     11a0 <main+0x40>
cmp    $0x41,%eax
jne    11a7 <main+0x47>
mov    $0x1,%r14d
jmp    11b1 <main+0x51>
nopl   0x0(%rax)
mov    $0x1,%r15d
jmp    11b1 <main+0x51>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1060 <init_log@plt>
xor    %eax,%eax
call   1040 <get_pagesize@plt>
mov    %r14d,%edi
mov    %r15d,%esi
call   1030 <calculate@plt>
mov    %eax,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"Avh\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
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %23, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %7
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %10
%16 = load i32, i32* %7
switch i32 %16, label %21 [
i32 118, label %17
i32 65, label %18
i32 104, label %19
]
17: ; preds = %15
store i32 1, i32* %8
br label %23
18: ; preds = %15
store i32 1, i32* %9
br label %23
19: ; preds = %15
%20 = call i32 @usage(i32 0)
br label %21
21: ; preds = %15, %19
%22 = call i32 @usage(i32 1)
br label %23
23: ; preds = %21, %18, %17
br label %10
24: ; preds = %10
%25 = call i32 @init_log(i32* null, i32 0, i32 0, i32 0, i32 0, i32* null)
%26 = call i32 (...) @get_pagesize()
%27 = load i32, i32* %9
%28 = load i32, i32* %8
%29 = call i32 @calculate(i32 %27, i32 %28)
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = call i32 @exit(i32 %30)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"Avh\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %19
5: ; preds = %2, %14
%6 = phi i32 [ %17, %14 ], [ %3, %2 ]
%7 = phi i32 [ %16, %14 ], [ 0, %2 ]
%8 = phi i32 [ %15, %14 ], [ 0, %2 ]
switch i32 %6, label %12 [
i32 118, label %14
i32 65, label %9
i32 104, label %10
]
9: ; preds = %5
br label %14
10: ; preds = %5
%11 = tail call i32 @usage(i32 0)
br label %12
12: ; preds = %5, %10
%13 = tail call i32 @usage(i32 1)
br label %14
14: ; preds = %5, %12, %9
%15 = phi i32 [ %8, %12 ], [ %8, %9 ], [ 1, %5 ]
%16 = phi i32 [ %7, %12 ], [ 1, %9 ], [ %7, %5 ]
%17 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%18 = icmp sgt i32 %17, 0
br i1 %18, label %5, label %19
19: ; preds = %14, %2
%20 = phi i32 [ 0, %2 ], [ %15, %14 ]
%21 = phi i32 [ 0, %2 ], [ %16, %14 ]
%22 = tail call i32 @init_log(i32* null, i32 0, i32 0, i32 0, i32 0, i32* null)
%23 = tail call i32 (...) @get_pagesize()
%24 = tail call i32 @calculate(i32 %21, i32 %20)
%25 = tail call i32 @exit(i32 %24)
unreachable
}