#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*/ dump(char *, char *, int);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int optind;
char *strdup(int /*<<< orphan*/);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  int opt;
  int by_sector = 0;
  char *out_name = NULL;
  while ((opt = getopt(argc, argv, "so:")) != -1) {
    switch (opt) {
    case 's':
      by_sector = 1;
      break;
    case 'o':
      out_name = strdup(optarg);
      break;
    default:
      usage(argv[0]);
    }
  }
  if ((optind + 1) != argc)
    usage(argv[0]);
  dump(argv[optind], out_name, by_sector);
  return 0;
}


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,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe8d(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11dd <main+0x9d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x6f,%eax
je     11b5 <main+0x75>
jmp    1198 <main+0x58>
mov    -0x24(%rbp),%eax
sub    $0x73,%eax
jne    11cc <main+0x8c>
jmp    11a9 <main+0x69>
movl   $0x1,-0x18(%rbp)
jmp    11d8 <main+0x98>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
call   1060 <strdup@plt>
mov    %rax,-0x20(%rbp)
jmp    11d8 <main+0x98>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usage@plt>
jmp    1165 <main+0x25>
mov    0x2dfc(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
je     11fe <main+0xbe>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x2dd7(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1030 <dump@plt>
xor    %eax,%eax
add    $0x30,%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,%rbx
mov    %edi,%ebp
xor    %r14d,%r14d
lea    0xea6(%rip),%r12
mov    0x2e97(%rip),%r13
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <getopt@plt>
cmp    $0xffffffff,%eax
je     11ac <main+0x6c>
cmp    $0x73,%eax
je     1196 <main+0x56>
cmp    $0x6f,%eax
je     119e <main+0x5e>
mov    (%rbx),%rdi
call   1040 <usage@plt>
jmp    1170 <main+0x30>
mov    $0x1,%r14d
jmp    1170 <main+0x30>
mov    0x0(%r13),%edi
call   1060 <strdup@plt>
mov    %rax,%r15
jmp    1170 <main+0x30>
mov    0x2e2d(%rip),%r12
mov    (%r12),%eax
lea    0x1(%rax),%ecx
cmp    %ebp,%ecx
je     11ca <main+0x8a>
mov    (%rbx),%rdi
call   1040 <usage@plt>
mov    (%r12),%eax
cltq
mov    (%rbx,%rax,8),%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1030 <dump@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"so:\00"
@optarg = global i32 0
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i8* null, i8** %8
br label %9
9: ; preds = %25, %2
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %6
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = load i32, i32* %6
switch i32 %15, label %20 [
i32 115, label %16
i32 111, label %17
]
16: ; preds = %14
store i32 1, i32* %7
br label %25
17: ; preds = %14
%18 = load i32, i32* @optarg
%19 = call i8* @strdup(i32 %18)
store i8* %19, i8** %8
br label %25
20: ; preds = %14
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @usage(i8* %23)
br label %25
25: ; preds = %20, %17, %16
br label %9
26: ; preds = %9
%27 = load i32, i32* @optind
%28 = add nsw i32 %27, 1
%29 = load i32, i32* %4
%30 = icmp ne i32 %28, %29
br i1 %30, label %31, label %36
31: ; preds = %26
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 @usage(i8* %34)
br label %36
36: ; preds = %31, %26
%37 = load i8**, i8*** %5
%38 = load i32, i32* @optind
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = load i8*, i8** %8
%43 = load i32, i32* %7
%44 = call i32 @dump(i8* %41, i8* %42, i32 %43)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"so:\00"
@optarg = global i32 0
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i32 [ 0, %2 ], [ 1, %8 ]
%5 = phi i8* [ null, %2 ], [ %7, %8 ]
br label %6
6: ; preds = %3, %10
%7 = phi i8* [ %5, %3 ], [ %12, %10 ]
br label %8
8: ; preds = %6, %13
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
switch i32 %9, label %13 [
i32 -1, label %16
i32 115, label %3
i32 111, label %10
]
10: ; preds = %8
%11 = load i32, i32* @optarg
%12 = tail call i8* @strdup(i32 %11)
br label %6
13: ; preds = %8
%14 = load i8*, i8** %1
%15 = tail call i32 @usage(i8* %14)
br label %8
16: ; preds = %8
%17 = load i32, i32* @optind
%18 = add nsw i32 %17, 1
%19 = icmp eq i32 %18, %0
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i8*, i8** %1
%22 = tail call i32 @usage(i8* %21)
%23 = load i32, i32* @optind
br label %24
24: ; preds = %20, %16
%25 = phi i32 [ %23, %20 ], [ %17, %16 ]
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %1, i64 %26
%28 = load i8*, i8** %27
%29 = tail call i32 @dump(i8* %28, i8* %7, i32 %4)
ret i32 0
}