#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ member_1;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ create_code();
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ file_error(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int getopt_long(int, char **, char *, struct option const *, int *);
int /*<<< orphan*/ list_sections();
int /*<<< orphan*/ no_argument;
int /*<<< orphan*/ *open_file(char *, char *);
char *optarg;
int optind;
int /*<<< orphan*/ output_code(int /*<<< orphan*/ *);
int /*<<< orphan*/ required_argument;
int /*<<< orphan*/ run_code(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ usage(int /*<<< orphan*/ *);
int /*<<< orphan*/ version();
int main(int argc, char **argv) {
  char *outfile = NULL;
  int read = 0, write = 0, output = 0, list = 0, c, index;
  const struct option long_options[] = {
      {"list", no_argument, NULL, 'l'},
      {"read", no_argument, NULL, 'r'},
      {"write", no_argument, NULL, 'w'},
      {"output", required_argument, NULL, 'o'},
      {"help", no_argument, NULL, 'h'},
      {"version", no_argument, NULL, 'v'},
      {NULL, 0, NULL, 0}};
  while ((c = getopt_long(argc, argv, "lrwho:", long_options, &index)) != -1) {
    switch (c) {
    case 'l':
      list = 1;
      break;
    case 'r':
      read = 1;
      break;
    case 'w':
      write = 1;
      break;
    case 'h':
      usage(stdout);
      return 0;
    case 'o':
      output = 1;
      outfile = optarg;
      break;
    case 'v':
      version();
      return 0;
    default:
      usage(stderr);
      return -1;
    }
  }
  if (write + read + list > 1) {
    fputs("Conflicting actions given simultaneously.\n", stderr);
    usage(stderr);
    return -1;
  } else if (!write + read + list) {
    write = 1;
  }
  if (output && !write) {
    fputs("It only makes sense to use --output with --write.\n", stderr);
    usage(stderr);
    return 1;
  }
  if (list) {
    list_sections();
  } else if (read) {
    FILE *f = NULL;
    for (index = optind; index < argc; index++) {
      f = open_file(argv[index], "r");
      run_code(argv[index], f);
      if (fclose(f))
        file_error(argv[index], "closing");
    }
    if (!f)
      run_code("stdin", stdin);
  } else {
    FILE *f;
    if (outfile)
      f = open_file(outfile, "w");
    else
      f = stdout;
    if (optind < argc) {
      fputs("--write takes no arguments\n", stderr);
      usage(stderr);
      return -1;
    }
    create_code();
    output_code(f);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe35(%rip),%rax
mov    %rax,-0x110(%rbp)
mov    0x2d9f(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x108(%rbp)
movq   $0x0,-0x100(%rbp)
movl   $0x6c,-0xf8(%rbp)
add    $0x20,%rdi
lea    0xe04(%rip),%rax
mov    %rax,-0xf0(%rbp)
mov    0x2d69(%rip),%rax
mov    (%rax),%eax
mov    %al,-0xe8(%rbp)
movq   $0x0,-0xe0(%rbp)
movl   $0x72,-0xd8(%rbp)
add    $0x20,%rdi
lea    0xdd3(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0x2d33(%rip),%rax
mov    (%rax),%eax
mov    %al,-0xc8(%rbp)
movq   $0x0,-0xc0(%rbp)
movl   $0x77,-0xb8(%rbp)
add    $0x20,%rdi
lea    0xda3(%rip),%rax
mov    %rax,-0xb0(%rbp)
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
mov    %al,-0xa8(%rbp)
movq   $0x0,-0xa0(%rbp)
movl   $0x6f,-0x98(%rbp)
add    $0x20,%rdi
lea    0xd74(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0x2cc7(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x88(%rbp)
movq   $0x0,-0x80(%rbp)
movl   $0x68,-0x78(%rbp)
add    $0x20,%rdi
lea    0xd49(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0x2c9a(%rip),%rax
mov    (%rax),%eax
mov    %al,-0x68(%rbp)
movq   $0x0,-0x60(%rbp)
movl   $0x76,-0x58(%rbp)
add    $0x20,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1090 <memset@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x110(%rbp),%rcx
lea    0xd0d(%rip),%rdx
lea    -0x30(%rbp),%r8
call   1070 <getopt_long@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
je     1427 <main+0x267>
mov    -0x2c(%rbp),%eax
add    $0xffffff98,%eax
mov    %eax,%ecx
mov    %rcx,-0x128(%rbp)
sub    $0xf,%eax
ja     1407 <main+0x247>
mov    -0x128(%rbp),%rax
lea    0xc6e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x28(%rbp)
jmp    1422 <main+0x262>
movl   $0x1,-0x1c(%rbp)
jmp    1422 <main+0x262>
movl   $0x1,-0x20(%rbp)
jmp    1422 <main+0x262>
mov    0x2bea(%rip),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1656 <main+0x496>
movl   $0x1,-0x24(%rbp)
mov    0x2c10(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1422 <main+0x262>
mov    $0x0,%al
call   10a0 <version@plt>
movl   $0x0,-0x4(%rbp)
jmp    1656 <main+0x496>
mov    0x2bb2(%rip),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1656 <main+0x496>
jmp    1342 <main+0x182>
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x28(%rbp),%eax
cmp    $0x1,%eax
jle    146a <main+0x2aa>
mov    0x2b80(%rip),%rax
mov    (%rax),%rsi
lea    0xc21(%rip),%rdi
call   1080 <fputs@plt>
mov    0x2b6a(%rip),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1656 <main+0x496>
cmpl   $0x0,-0x20(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    -0x1c(%rbp),%eax
add    -0x28(%rbp),%eax
cmp    $0x0,%eax
je     148e <main+0x2ce>
movl   $0x1,-0x20(%rbp)
jmp    1493 <main+0x2d3>
cmpl   $0x0,-0x24(%rbp)
je     14d8 <main+0x318>
cmpl   $0x0,-0x20(%rbp)
jne    14d8 <main+0x318>
mov    0x2b12(%rip),%rax
mov    (%rax),%rsi
lea    0xbde(%rip),%rdi
call   1080 <fputs@plt>
mov    0x2afc(%rip),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    1656 <main+0x496>
cmpl   $0x0,-0x28(%rbp)
je     14ee <main+0x32e>
mov    $0x0,%al
call   1030 <list_sections@plt>
jmp    164f <main+0x48f>
cmpl   $0x0,-0x1c(%rbp)
je     15bc <main+0x3fc>
movq   $0x0,-0x118(%rbp)
mov    0x2ace(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1593 <main+0x3d3>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xb9b(%rip),%rsi
call   1060 <open_file@plt>
mov    %rax,-0x118(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x118(%rbp),%rsi
call   10e0 <run_code@plt>
mov    -0x118(%rbp),%rdi
call   1050 <fclose@plt>
cmp    $0x0,%rax
je     1580 <main+0x3c0>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xb50(%rip),%rsi
call   10d0 <file_error@plt>
jmp    1585 <main+0x3c5>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    150f <main+0x34f>
cmpq   $0x0,-0x118(%rbp)
jne    15b7 <main+0x3f7>
mov    0x2a38(%rip),%rax
mov    (%rax),%rsi
lea    0xb21(%rip),%rdi
call   10e0 <run_code@plt>
jmp    164a <main+0x48a>
cmpq   $0x0,-0x18(%rbp)
je     15e3 <main+0x423>
mov    -0x18(%rbp),%rdi
lea    0xb07(%rip),%rsi
call   1060 <open_file@plt>
mov    %rax,-0x120(%rbp)
jmp    15f4 <main+0x434>
mov    0x29c6(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x120(%rbp)
mov    0x29dd(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1637 <main+0x477>
mov    0x29b3(%rip),%rax
mov    (%rax),%rsi
lea    0xac4(%rip),%rdi
call   1080 <fputs@plt>
mov    0x299d(%rip),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1656 <main+0x496>
mov    $0x0,%al
call   1040 <create_code@plt>
mov    -0x120(%rbp),%rdi
call   10c0 <output_code@plt>
jmp    164f <main+0x48f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r12
mov    %edi,%r15d
lea    0xe72(%rip),%rax
mov    %rax,0x20(%rsp)
mov    0x2dde(%rip),%rax
mov    (%rax),%al
mov    %al,0x28(%rsp)
movq   $0x0,0x30(%rsp)
movl   $0x6c,0x38(%rsp)
lea    0xe4d(%rip),%rcx
mov    %rcx,0x40(%rsp)
mov    %al,0x48(%rsp)
movq   $0x0,0x50(%rsp)
movl   $0x72,0x58(%rsp)
lea    0xe31(%rip),%rcx
mov    %rcx,0x60(%rsp)
mov    %al,0x68(%rsp)
movq   $0x0,0x70(%rsp)
movl   $0x77,0x78(%rsp)
lea    0xe16(%rip),%rcx
mov    %rcx,0x80(%rsp)
mov    0x2d87(%rip),%rcx
mov    (%rcx),%cl
mov    %cl,0x88(%rsp)
movq   $0x0,0x90(%rsp)
movl   $0x6f,0x98(%rsp)
lea    0xde7(%rip),%rcx
mov    %rcx,0xa0(%rsp)
mov    %al,0xa8(%rsp)
movq   $0x0,0xb0(%rsp)
movl   $0x68,0xb8(%rsp)
lea    0xdbf(%rip),%rcx
mov    %rcx,0xc0(%rsp)
mov    %al,0xc8(%rsp)
movq   $0x0,0xd0(%rsp)
movl   $0x76,0xd8(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
mov    $0x1,%al
mov    %eax,0x4(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
lea    0xd7a(%rip),%r13
lea    0x20(%rsp),%rbx
mov    %rsp,%rbp
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %r14d,%r14d
mov    %r14d,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,%r14d
mov    %r15d,%edi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1070 <getopt_long@plt>
mov    $0x1,%ecx
cmp    $0x6c,%eax
je     1310 <main+0x160>
lea    -0x68(%rax),%ecx
cmp    $0xf,%ecx
ja     137a <main+0x1ca>
lea    0xcc0(%rip),%rdx
movslq (%rdx,%rcx,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    0x2ca8(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rsp)
movl   $0x0,0x4(%rsp)
jmp    1303 <main+0x153>
mov    $0x1,%eax
mov    %rax,0x18(%rsp)
jmp    1303 <main+0x153>
mov    $0x1,%eax
mov    %rax,0x10(%rsp)
jmp    1303 <main+0x153>
cmp    $0xffffffff,%eax
jne    13b9 <main+0x209>
mov    0x18(%rsp),%rcx
mov    0x10(%rsp),%rsi
lea    (%rsi,%rcx,1),%eax
add    %r14d,%eax
cmp    $0x2,%eax
jb     13ff <main+0x24f>
mov    0x2c25(%rip),%rbx
mov    (%rbx),%rcx
lea    0xcc6(%rip),%rdi
mov    $0x2a,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
mov    (%rbx),%rdi
jmp    13c3 <main+0x213>
mov    0x2c00(%rip),%rax
mov    (%rax),%rdi
call   1090 <usage@plt>
mov    $0xffffffff,%ebx
jmp    13eb <main+0x23b>
mov    0x2bda(%rip),%rax
mov    (%rax),%rdi
call   1090 <usage@plt>
xor    %ebx,%ebx
jmp    13eb <main+0x23b>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <version@plt>
mov    %ebx,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %esi,%eax
xor    $0x1,%eax
add    %ecx,%eax
add    %r14d,%eax
setne  %al
mov    0x4(%rsp),%edx
or     %al,%dl
test   $0x1,%dl
jne    144a <main+0x29a>
test   %esi,%esi
jne    144a <main+0x29a>
mov    0x2b9e(%rip),%rbx
mov    (%rbx),%rcx
lea    0xc6a(%rip),%rdi
mov    $0x32,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
mov    (%rbx),%rdi
call   1090 <usage@plt>
mov    $0x1,%ebx
jmp    13eb <main+0x23b>
test   %r14d,%r14d
je     145a <main+0x2aa>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <list_sections@plt>
jmp    13eb <main+0x23b>
test   %ecx,%ecx
je     14d1 <main+0x321>
mov    0x2b73(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
cmp    %r15d,%eax
jge    14f7 <main+0x347>
lea    0xc4f(%rip),%rbx
lea    0xc4a(%rip),%r14
jmp    1491 <main+0x2e1>
mov    (%rsp),%eax
add    $0x1,%eax
mov    %eax,(%rsp)
cmp    %r15d,%eax
jge    14ec <main+0x33c>
cltq
mov    (%r12,%rax,8),%rdi
mov    %rbx,%rsi
call   1060 <open_file@plt>
mov    %rax,%rbp
movslq (%rsp),%rax
mov    (%r12,%rax,8),%rdi
mov    %rbp,%rsi
call   10d0 <run_code@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
test   %rax,%rax
je     1483 <main+0x2d3>
movslq (%rsp),%rax
mov    (%r12,%rax,8),%rdi
mov    %r14,%rsi
call   10c0 <file_error@plt>
jmp    1483 <main+0x2d3>
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     1514 <main+0x364>
lea    0xbf7(%rip),%rsi
call   1060 <open_file@plt>
mov    %rax,%rbp
jmp    151e <main+0x36e>
xor    %ebx,%ebx
test   %rbp,%rbp
jne    13eb <main+0x23b>
mov    0x2ae2(%rip),%rax
mov    (%rax),%rsi
lea    0xbcb(%rip),%rdi
call   10d0 <run_code@plt>
xor    %ebx,%ebx
jmp    13eb <main+0x23b>
mov    0x2a95(%rip),%rax
mov    (%rax),%rbp
mov    0x2ab3(%rip),%rax
cmp    %r15d,(%rax)
jge    1545 <main+0x395>
mov    0x2a8f(%rip),%rbx
mov    (%rbx),%rcx
lea    0xba0(%rip),%rdi
mov    $0x1b,%esi
jmp    13aa <main+0x1fa>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <create_code@plt>
mov    %rbp,%rdi
call   10a0 <output_code@plt>
jmp    13eb <main+0x23b>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [5 x i8] c"list\00"
@no_argument = global i32 0
@.str.1 = [5 x i8] c"read\00"
@.str.2 = [6 x i8] c"write\00"
@.str.3 = [7 x i8] c"output\00"
@required_argument = global i32 0
@.str.4 = [5 x i8] c"help\00"
@.str.5 = [8 x i8] c"version\00"
@.str.6 = [7 x i8] c"lrwho:\00"
@stdout = global i32* null
@optarg = global i8* null
@stderr = global i32* null
@.str.7 = [43 x i8] c"Conflicting actions given simultaneously.\0A\00"
@.str.8 = [51 x i8] c"It only makes sense to use --output with --write.\0A\00"
@optind = global i32 0
@.str.9 = [2 x i8] c"r\00"
@.str.10 = [8 x i8] c"closing\00"
@.str.11 = [6 x i8] c"stdin\00"
@stdin = global i32* null
@.str.12 = [2 x i8] c"w\00"
@.str.13 = [28 x i8] c"--write takes no arguments\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [7 x %struct.option]
%14 = alloca i32*
%15 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%16 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %13, i64 0, i64 0
%17 = getelementptr inbounds %struct.option, %struct.option* %16, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %17
%18 = getelementptr inbounds %struct.option, %struct.option* %16, i32 0, i32 1
%19 = load i32, i32* @no_argument
%20 = trunc i32 %19 to i8
store i8 %20, i8* %18
%21 = getelementptr inbounds %struct.option, %struct.option* %16, i32 0, i32 2
store i32* null, i32** %21
%22 = getelementptr inbounds %struct.option, %struct.option* %16, i32 0, i32 3
store i32 108, i32* %22
%23 = getelementptr inbounds %struct.option, %struct.option* %16, i64 1
%24 = getelementptr inbounds %struct.option, %struct.option* %23, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %24
%25 = getelementptr inbounds %struct.option, %struct.option* %23, i32 0, i32 1
%26 = load i32, i32* @no_argument
%27 = trunc i32 %26 to i8
store i8 %27, i8* %25
%28 = getelementptr inbounds %struct.option, %struct.option* %23, i32 0, i32 2
store i32* null, i32** %28
%29 = getelementptr inbounds %struct.option, %struct.option* %23, i32 0, i32 3
store i32 114, i32* %29
%30 = getelementptr inbounds %struct.option, %struct.option* %23, i64 1
%31 = getelementptr inbounds %struct.option, %struct.option* %30, i32 0, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %31
%32 = getelementptr inbounds %struct.option, %struct.option* %30, i32 0, i32 1
%33 = load i32, i32* @no_argument
%34 = trunc i32 %33 to i8
store i8 %34, i8* %32
%35 = getelementptr inbounds %struct.option, %struct.option* %30, i32 0, i32 2
store i32* null, i32** %35
%36 = getelementptr inbounds %struct.option, %struct.option* %30, i32 0, i32 3
store i32 119, i32* %36
%37 = getelementptr inbounds %struct.option, %struct.option* %30, i64 1
%38 = getelementptr inbounds %struct.option, %struct.option* %37, i32 0, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %38
%39 = getelementptr inbounds %struct.option, %struct.option* %37, i32 0, i32 1
%40 = load i32, i32* @required_argument
%41 = trunc i32 %40 to i8
store i8 %41, i8* %39
%42 = getelementptr inbounds %struct.option, %struct.option* %37, i32 0, i32 2
store i32* null, i32** %42
%43 = getelementptr inbounds %struct.option, %struct.option* %37, i32 0, i32 3
store i32 111, i32* %43
%44 = getelementptr inbounds %struct.option, %struct.option* %37, i64 1
%45 = getelementptr inbounds %struct.option, %struct.option* %44, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %45
%46 = getelementptr inbounds %struct.option, %struct.option* %44, i32 0, i32 1
%47 = load i32, i32* @no_argument
%48 = trunc i32 %47 to i8
store i8 %48, i8* %46
%49 = getelementptr inbounds %struct.option, %struct.option* %44, i32 0, i32 2
store i32* null, i32** %49
%50 = getelementptr inbounds %struct.option, %struct.option* %44, i32 0, i32 3
store i32 104, i32* %50
%51 = getelementptr inbounds %struct.option, %struct.option* %44, i64 1
%52 = getelementptr inbounds %struct.option, %struct.option* %51, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %52
%53 = getelementptr inbounds %struct.option, %struct.option* %51, i32 0, i32 1
%54 = load i32, i32* @no_argument
%55 = trunc i32 %54 to i8
store i8 %55, i8* %53
%56 = getelementptr inbounds %struct.option, %struct.option* %51, i32 0, i32 2
store i32* null, i32** %56
%57 = getelementptr inbounds %struct.option, %struct.option* %51, i32 0, i32 3
store i32 118, i32* %57
%58 = getelementptr inbounds %struct.option, %struct.option* %51, i64 1
%59 = bitcast %struct.option* %58 to i8*
br label %60
60: ; preds = %81, %2
%61 = load i32, i32* %4
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %13, i64 0, i64 0
%64 = call i32 @getopt_long(i32 %61, i8** %62, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), %struct.option* %63, i32* %12)
store i32 %64, i32* %11
%65 = icmp ne i32 %64, -1
br i1 %65, label %66, label %82
66: ; preds = %60
%67 = load i32, i32* %11
switch i32 %67, label %78 [
i32 108, label %68
i32 114, label %69
i32 119, label %70
i32 104, label %71
i32 111, label %74
i32 118, label %76
]
68: ; preds = %66
store i32 1, i32* %10
br label %81
69: ; preds = %66
store i32 1, i32* %7
br label %81
70: ; preds = %66
store i32 1, i32* %8
br label %81
71: ; preds = %66
%72 = load i32*, i32** @stdout
%73 = call i32 @usage(i32* %72)
store i32 0, i32* %3
br label %189
74: ; preds = %66
store i32 1, i32* %9
%75 = load i8*, i8** @optarg
store i8* %75, i8** %6
br label %81
76: ; preds = %66
%77 = call i32 (...) @version()
store i32 0, i32* %3
br label %189
78: ; preds = %66
%79 = load i32*, i32** @stderr
%80 = call i32 @usage(i32* %79)
store i32 -1, i32* %3
br label %189
81: ; preds = %74, %70, %69, %68
br label %60
82: ; preds = %60
%83 = load i32, i32* %8
%84 = load i32, i32* %7
%85 = add nsw i32 %83, %84
%86 = load i32, i32* %10
%87 = add nsw i32 %85, %86
%88 = icmp sgt i32 %87, 1
br i1 %88, label %89, label %94
89: ; preds = %82
%90 = load i32*, i32** @stderr
%91 = call i32 @fputs(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32* %90)
%92 = load i32*, i32** @stderr
%93 = call i32 @usage(i32* %92)
store i32 -1, i32* %3
br label %189
94: ; preds = %82
%95 = load i32, i32* %8
%96 = icmp ne i32 %95, 0
%97 = xor i1 %96, true
%98 = zext i1 %97 to i32
%99 = load i32, i32* %7
%100 = add nsw i32 %98, %99
%101 = load i32, i32* %10
%102 = add nsw i32 %100, %101
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %105
104: ; preds = %94
store i32 1, i32* %8
br label %105
105: ; preds = %104, %94
br label %106
106: ; preds = %105
%107 = load i32, i32* %9
%108 = icmp ne i32 %107, 0
br i1 %108, label %109, label %117
109: ; preds = %106
%110 = load i32, i32* %8
%111 = icmp ne i32 %110, 0
br i1 %111, label %117, label %112
112: ; preds = %109
%113 = load i32*, i32** @stderr
%114 = call i32 @fputs(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), i32* %113)
%115 = load i32*, i32** @stderr
%116 = call i32 @usage(i32* %115)
store i32 1, i32* %3
br label %189
117: ; preds = %109, %106
%118 = load i32, i32* %10
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %122
120: ; preds = %117
%121 = call i32 (...) @list_sections()
br label %188
122: ; preds = %117
%123 = load i32, i32* %7
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %166
125: ; preds = %122
store i32* null, i32** %14
%126 = load i32, i32* @optind
store i32 %126, i32* %12
br label %127
127: ; preds = %156, %125
%128 = load i32, i32* %12
%129 = load i32, i32* %4
%130 = icmp slt i32 %128, %129
br i1 %130, label %131, label %159
131: ; preds = %127
%132 = load i8**, i8*** %5
%133 = load i32, i32* %12
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i8*, i8** %132, i64 %134
%136 = load i8*, i8** %135
%137 = call i32* @open_file(i8* %136, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %137, i32** %14
%138 = load i8**, i8*** %5
%139 = load i32, i32* %12
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8*, i8** %138, i64 %140
%142 = load i8*, i8** %141
%143 = load i32*, i32** %14
%144 = call i32 @run_code(i8* %142, i32* %143)
%145 = load i32*, i32** %14
%146 = call i64 @fclose(i32* %145)
%147 = icmp ne i64 %146, 0
br i1 %147, label %148, label %155
148: ; preds = %131
%149 = load i8**, i8*** %5
%150 = load i32, i32* %12
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds i8*, i8** %149, i64 %151
%153 = load i8*, i8** %152
%154 = call i32 @file_error(i8* %153, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %155
155: ; preds = %148, %131
br label %156
156: ; preds = %155
%157 = load i32, i32* %12
%158 = add nsw i32 %157, 1
store i32 %158, i32* %12
br label %127
159: ; preds = %127
%160 = load i32*, i32** %14
%161 = icmp ne i32* %160, null
br i1 %161, label %165, label %162
162: ; preds = %159
%163 = load i32*, i32** @stdin
%164 = call i32 @run_code(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32* %163)
br label %165
165: ; preds = %162, %159
br label %187
166: ; preds = %122
%167 = load i8*, i8** %6
%168 = icmp ne i8* %167, null
br i1 %168, label %169, label %172
169: ; preds = %166
%170 = load i8*, i8** %6
%171 = call i32* @open_file(i8* %170, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i32* %171, i32** %15
br label %174
172: ; preds = %166
%173 = load i32*, i32** @stdout
store i32* %173, i32** %15
br label %174
174: ; preds = %172, %169
%175 = load i32, i32* @optind
%176 = load i32, i32* %4
%177 = icmp slt i32 %175, %176
br i1 %177, label %178, label %183
178: ; preds = %174
%179 = load i32*, i32** @stderr
%180 = call i32 @fputs(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i32* %179)
%181 = load i32*, i32** @stderr
%182 = call i32 @usage(i32* %181)
store i32 -1, i32* %3
br label %189
183: ; preds = %174
%184 = call i32 (...) @create_code()
%185 = load i32*, i32** %15
%186 = call i32 @output_code(i32* %185)
br label %187
187: ; preds = %183, %165
br label %188
188: ; preds = %187, %120
store i32 0, i32* %3
br label %189
189: ; preds = %188, %178, %112, %89, %78, %76, %71
%190 = load i32, i32* %3
ret i32 %190
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
@.str = [5 x i8] c"list\00"
@no_argument = global i32 0
@.str.1 = [5 x i8] c"read\00"
@.str.2 = [6 x i8] c"write\00"
@.str.3 = [7 x i8] c"output\00"
@required_argument = global i32 0
@.str.4 = [5 x i8] c"help\00"
@.str.5 = [8 x i8] c"version\00"
@.str.6 = [7 x i8] c"lrwho:\00"
@stdout = global i32* null
@optarg = global i8* null
@stderr = global i32* null
@.str.7 = [43 x i8] c"Conflicting actions given simultaneously.\0A\00"
@.str.8 = [51 x i8] c"It only makes sense to use --output with --write.\0A\00"
@optind = global i32 0
@.str.9 = [2 x i8] c"r\00"
@.str.10 = [8 x i8] c"closing\00"
@.str.11 = [6 x i8] c"stdin\00"
@stdin = global i32* null
@.str.12 = [2 x i8] c"w\00"
@.str.13 = [28 x i8] c"--write takes no arguments\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [7 x %struct.option]
%5 = bitcast i32* %3 to i8*
%6 = bitcast [7 x %struct.option]* %4 to i8*
%7 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 0
%8 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 0, i32 1
%10 = load i32, i32* @no_argument
%11 = trunc i32 %10 to i8
store i8 %11, i8* %9
%12 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 0, i32 2
store i32* null, i32** %12
%13 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 0, i32 3
store i32 108, i32* %13
%14 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 1, i32 1
store i8 %11, i8* %15
%16 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 1, i32 2
store i32* null, i32** %16
%17 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 1, i32 3
store i32 114, i32* %17
%18 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 2, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %18
%19 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 2, i32 1
store i8 %11, i8* %19
%20 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 2, i32 2
store i32* null, i32** %20
%21 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 2, i32 3
store i32 119, i32* %21
%22 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 3, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %22
%23 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 3, i32 1
%24 = load i32, i32* @required_argument
%25 = trunc i32 %24 to i8
store i8 %25, i8* %23
%26 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 3, i32 2
store i32* null, i32** %26
%27 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 3, i32 3
store i32 111, i32* %27
%28 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 4, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %28
%29 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 4, i32 1
store i8 %11, i8* %29
%30 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 4, i32 2
store i32* null, i32** %30
%31 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 4, i32 3
store i32 104, i32* %31
%32 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 5, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8** %32
%33 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 5, i32 1
store i8 %11, i8* %33
%34 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 5, i32 2
store i32* null, i32** %34
%35 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 5, i32 3
store i32 118, i32* %35
%36 = getelementptr inbounds [7 x %struct.option], [7 x %struct.option]* %4, i64 0, i64 6
%37 = bitcast %struct.option* %36 to i8*
br label %38
38: ; preds = %57, %2
%39 = phi i8* [ %58, %57 ], [ null, %2 ]
%40 = phi i32 [ %45, %57 ], [ 0, %2 ]
%41 = phi i32 [ %49, %57 ], [ 0, %2 ]
%42 = phi i1 [ false, %57 ], [ true, %2 ]
%43 = phi i32 [ %52, %57 ], [ 0, %2 ]
br label %44
44: ; preds = %51, %38
%45 = phi i32 [ %40, %38 ], [ 1, %51 ]
%46 = phi i32 [ %41, %38 ], [ %49, %51 ]
%47 = phi i32 [ %43, %38 ], [ %52, %51 ]
br label %48
48: ; preds = %51, %44
%49 = phi i32 [ %46, %44 ], [ 1, %51 ]
%50 = phi i32 [ %47, %44 ], [ %52, %51 ]
br label %51
51: ; preds = %48, %51
%52 = phi i32 [ 1, %51 ], [ %50, %48 ]
%53 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), %struct.option* %7, i32* %3)
switch i32 %53, label %61 [
i32 -1, label %64
i32 108, label %51
i32 114, label %44
i32 119, label %48
i32 104, label %54
i32 111, label %57
i32 118, label %59
]
54: ; preds = %51
%55 = load i32*, i32** @stdout
%56 = call i32 @usage(i32* %55)
br label %141
57: ; preds = %51
%58 = load i8*, i8** @optarg
br label %38
59: ; preds = %51
%60 = call i32 (...) @version()
br label %141
61: ; preds = %51
%62 = load i32*, i32** @stderr
%63 = call i32 @usage(i32* %62)
br label %141
64: ; preds = %51
%65 = add nuw nsw i32 %49, %45
%66 = add nuw nsw i32 %65, %52
%67 = icmp ugt i32 %66, 1
br i1 %67, label %68, label %73
68: ; preds = %64
%69 = load i32*, i32** @stderr
%70 = call i64 @fwrite(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i64 42, i64 1, i32* %69)
%71 = load i32*, i32** @stderr
%72 = call i32 @usage(i32* %71)
br label %141
73: ; preds = %64
%74 = xor i32 %49, 1
%75 = add nuw nsw i32 %45, %74
%76 = sub nsw i32 0, %52
%77 = icmp ne i32 %75, %76
%78 = icmp ne i32 %49, 0
%79 = select i1 %42, i1 true, i1 %77
%80 = select i1 %79, i1 true, i1 %78
br i1 %80, label %86, label %81
81: ; preds = %73
%82 = load i32*, i32** @stderr
%83 = call i64 @fwrite(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), i64 50, i64 1, i32* %82)
%84 = load i32*, i32** @stderr
%85 = call i32 @usage(i32* %84)
br label %141
86: ; preds = %73
%87 = icmp eq i32 %52, 0
br i1 %87, label %90, label %88
88: ; preds = %86
%89 = call i32 (...) @list_sections()
br label %141
90: ; preds = %86
%91 = icmp eq i32 %45, 0
br i1 %91, label %123, label %92
92: ; preds = %90
%93 = load i32, i32* @optind
store i32 %93, i32* %3
%94 = icmp slt i32 %93, %0
br i1 %94, label %95, label %120
95: ; preds = %92, %114
%96 = phi i32 [ %116, %114 ], [ %93, %92 ]
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8*, i8** %1, i64 %97
%99 = load i8*, i8** %98
%100 = call i32* @open_file(i8* %99, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%101 = load i32, i32* %3
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8*, i8** %1, i64 %102
%104 = load i8*, i8** %103
%105 = call i32 @run_code(i8* %104, i32* %100)
%106 = call i64 @fclose(i32* %100)
%107 = icmp eq i64 %106, 0
br i1 %107, label %114, label %108
108: ; preds = %95
%109 = load i32, i32* %3
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8*, i8** %1, i64 %110
%112 = load i8*, i8** %111
%113 = call i32 @file_error(i8* %112, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %114
114: ; preds = %95, %108
%115 = load i32, i32* %3
%116 = add nsw i32 %115, 1
store i32 %116, i32* %3
%117 = icmp slt i32 %116, %0
br i1 %117, label %95, label %118
118: ; preds = %114
%119 = icmp eq i32* %100, null
br i1 %119, label %120, label %141
120: ; preds = %92, %118
%121 = load i32*, i32** @stdin
%122 = call i32 @run_code(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32* %121)
br label %141
123: ; preds = %90
%124 = icmp eq i8* %39, null
br i1 %124, label %127, label %125
125: ; preds = %123
%126 = call i32* @open_file(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
br label %129
127: ; preds = %123
%128 = load i32*, i32** @stdout
br label %129
129: ; preds = %127, %125
%130 = phi i32* [ %126, %125 ], [ %128, %127 ]
%131 = load i32, i32* @optind
%132 = icmp slt i32 %131, %0
br i1 %132, label %133, label %138
133: ; preds = %129
%134 = load i32*, i32** @stderr
%135 = call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i64 27, i64 1, i32* %134)
%136 = load i32*, i32** @stderr
%137 = call i32 @usage(i32* %136)
br label %141
138: ; preds = %129
%139 = call i32 (...) @create_code()
%140 = call i32 @output_code(i32* %130)
br label %141
141: ; preds = %88, %120, %118, %138, %133, %81, %68, %61, %59, %54
%142 = phi i32 [ -1, %61 ], [ 0, %59 ], [ 0, %54 ], [ -1, %68 ], [ 1, %81 ], [ -1, %133 ], [ 0, %138 ], [ 0, %118 ], [ 0, %120 ], [ 0, %88 ]
ret i32 %142
}