#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 print_usage();
int get_arguments(int argc, const char *argv[], int *output) {
  int ret = 0;
  if (argc == 2) {
    if (*argv[1] == '-') {
      if (*++argv[1] == 'o') {
        *output = 0;
      } else if (*argv[1] == 'x') {
        *output = 1;
      } else {
        ret = print_usage();
      }
    }
  } else {
    ret = print_usage();
  }
  return ret;
}


x86 assembly (clang, -O0):
<get_arguments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    11b3 <get_arguments+0xa3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11ae <get_arguments+0x9e>
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,0x8(%rcx)
movsbl 0x1(%rax),%eax
cmp    $0x6f,%eax
jne    1177 <get_arguments+0x67>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    11a9 <get_arguments+0x99>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x78,%eax
jne    119a <get_arguments+0x8a>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
jmp    11a4 <get_arguments+0x94>
mov    $0x0,%al
call   1030 <print_usage@plt>
mov    %eax,-0x1c(%rbp)
jmp    11a9 <get_arguments+0x99>
jmp    11ae <get_arguments+0x9e>
jmp    11bd <get_arguments+0xad>
mov    $0x0,%al
call   1030 <print_usage@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_arguments>:
cmp    $0x2,%edi
jne    113a <get_arguments+0x2a>
mov    0x8(%rsi),%rax
cmpb   $0x2d,(%rax)
jne    1147 <get_arguments+0x37>
lea    0x1(%rax),%rcx
mov    %rcx,0x8(%rsi)
mov    0x1(%rax),%al
cmp    $0x78,%al
je     1141 <get_arguments+0x31>
cmp    $0x6f,%al
jne    113a <get_arguments+0x2a>
movl   $0x0,(%rdx)
xor    %eax,%eax
ret
xor    %eax,%eax
jmp    1030 <print_usage@plt>
movl   $0x1,(%rdx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @get_arguments(i32 %0, i8** %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* %2, i32** %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %41
10: ; preds = %3
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 45
br i1 %16, label %17, label %40
17: ; preds = %10
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %19
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 111
br i1 %24, label %25, label %27
25: ; preds = %17
%26 = load i32*, i32** %6
store i32 0, i32* %26
br label %39
27: ; preds = %17
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 120
br i1 %33, label %34, label %36
34: ; preds = %27
%35 = load i32*, i32** %6
store i32 1, i32* %35
br label %38
36: ; preds = %27
%37 = call i32 (...) @print_usage()
store i32 %37, i32* %7
br label %38
38: ; preds = %36, %34
br label %39
39: ; preds = %38, %25
br label %40
40: ; preds = %39, %10
br label %43
41: ; preds = %3
%42 = call i32 (...) @print_usage()
store i32 %42, i32* %7
br label %43
43: ; preds = %41, %40
%44 = load i32, i32* %7
ret i32 %44
}

LLVM IR (-O2):
define i32 @get_arguments(i32 %0, i8** nocapture %1, i32* nocapture writeonly %2) {
%4 = icmp eq i32 %0, 2
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 45
br i1 %9, label %10, label %19
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %11, i8** %6
%12 = load i8, i8* %11
switch i8 %12, label %15 [
i8 111, label %13
i8 120, label %14
]
13: ; preds = %10
store i32 0, i32* %2
br label %19
14: ; preds = %10
store i32 1, i32* %2
br label %19
15: ; preds = %10
%16 = tail call i32 (...) @print_usage()
br label %19
17: ; preds = %3
%18 = tail call i32 (...) @print_usage()
br label %19
19: ; preds = %5, %14, %15, %13, %17
%20 = phi i32 [ 0, %13 ], [ 0, %14 ], [ %16, %15 ], [ 0, %5 ], [ %18, %17 ]
ret i32 %20
}