#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 */
typedef int uint64_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ errno;
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(void *);
size_t fwrite(void *, int, size_t, int /*<<< orphan*/ *);
int gen_pgtbl_x86_64(int, int, void **, size_t *);
int getopt(int, char **, char *);
char *optarg;
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
char *strerror(int /*<<< orphan*/);
int strtoull(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ usage(char **);
int main(int argc, char *argv[]) {
  int ret = 1;
  uint64_t base_address = 0;
  char *filename = NULL;
  char *arch = NULL;
  void *buf = NULL;
  size_t buf_size = 0;
  int c;
  while ((c = getopt(argc, argv, "ho:a:b:")) != -1)
    switch (c) {
    case '?':
    case 'h':
      usage(argv);
      return 0;
    case 'o':
      filename = optarg;
      break;
    case 'a':
      arch = optarg;
      break;
    case 'b':
      base_address = strtoull(optarg, NULL, 0);
      break;
    default:
      break;
    }
  if (!filename) {
    fprintf(stderr, "E: Missing filename.\n");
    goto done;
  }
  if (!arch) {
    fprintf(stderr, "E: Missing architecture.\n");
    goto done;
  } else if (strcmp(arch, "x86_64") != 0) {
    fprintf(stderr, "E: Unsupported architecture.\n");
    goto done;
  }
  if (base_address & 4095) {
    fprintf(stderr, "E: Base address not 4 KiB aligned\n");
    goto done;
  }
  if (strcmp(arch, "x86_64") == 0)
    ret = gen_pgtbl_x86_64(base_address, 4, &buf, &buf_size);
  if (ret) {
    fprintf(stderr, "Failed to generate page tables\n");
    goto done;
  }
  FILE *fd = fopen(filename, "wb");
  if (!fd) {
    fprintf(stderr, "%s open failed: %s\n", filename, strerror(errno));
    goto done;
  }
  if (fwrite(buf, 1, buf_size, fd) != buf_size) {
    fprintf(stderr, "%s write failed: %s\n", filename, strerror(errno));
    fclose(fd);
    goto done;
  }
  if (fclose(fd)) {
    fprintf(stderr, "%s close failed: %s\n", filename, strerror(errno));
    goto done;
  }
  ret = 0;
done:
  free(buf);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xebf(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0xffffffff,%eax
je     12a1 <main+0xf1>
mov    -0x3c(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x50(%rbp)
sub    $0x30,%eax
ja     1297 <main+0xe7>
mov    -0x50(%rbp),%rax
lea    0xdca(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
call   1080 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    14dd <main+0x32d>
mov    0x2d9d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    129c <main+0xec>
mov    0x2d8a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    129c <main+0xec>
mov    0x2d77(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtoull@plt>
mov    %eax,-0x18(%rbp)
jmp    129c <main+0xec>
jmp    129c <main+0xec>
jmp    11f7 <main+0x47>
cmpq   $0x0,-0x20(%rbp)
jne    12c8 <main+0x118>
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
lea    0xe10(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    14ce <main+0x31e>
cmpq   $0x0,-0x28(%rbp)
jne    12ef <main+0x13f>
mov    0x2cfe(%rip),%rax
mov    (%rax),%edi
lea    0xdff(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    14ce <main+0x31e>
mov    -0x28(%rbp),%rdi
lea    0xe02(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1325 <main+0x175>
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
lea    0xdea(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    14ce <main+0x31e>
jmp    132a <main+0x17a>
mov    -0x18(%rbp),%eax
and    $0xfff,%eax
cmp    $0x0,%eax
je     1357 <main+0x1a7>
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
lea    0xdd6(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    14ce <main+0x31e>
mov    -0x28(%rbp),%rdi
lea    0xd9a(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1389 <main+0x1d9>
mov    -0x18(%rbp),%edi
mov    $0x4,%esi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   10c0 <gen_pgtbl_x86_64@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     13af <main+0x1ff>
mov    0x2c3e(%rip),%rax
mov    (%rax),%edi
lea    0xda1(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    14ce <main+0x31e>
mov    -0x20(%rbp),%rdi
lea    0xdaa(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    140d <main+0x25d>
mov    0x2c03(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2be7(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rdx
mov    %rax,%rcx
lea    0xd66(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    14ce <main+0x31e>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    $0x1,%esi
call   10b0 <fwrite@plt>
cmp    -0x38(%rbp),%rax
je     1475 <main+0x2c5>
mov    0x2ba4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    0x2b88(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    %rax,%rcx
lea    0xd1b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
jmp    14ce <main+0x31e>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     14c7 <main+0x317>
mov    0x2b49(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    0x2b2d(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rdx
mov    %rax,%rcx
lea    0xcd5(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    14ce <main+0x31e>
movl   $0x0,-0x14(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
lea    0xee2(%rip),%r13
lea    0xe17(%rip),%r14
xor    %r15d,%r15d
xor    %r12d,%r12d
jmp    1205 <main+0x55>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
je     1264 <main+0xb4>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10a0 <getopt@plt>
lea    -0x3f(%rax),%ecx
cmp    $0x30,%ecx
ja     1200 <main+0x50>
movslq (%r14,%rcx,4),%rax
add    %r14,%rax
jmp    *%rax
mov    0x2dce(%rip),%rax
mov    (%rax),%r12
jmp    1205 <main+0x55>
mov    0x2dc2(%rip),%rax
mov    (%rax),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtoull@plt>
mov    %rax,0x10(%rsp)
jmp    1205 <main+0x55>
mov    0x2da8(%rip),%rax
mov    (%rax),%r15
jmp    1205 <main+0x55>
mov    %rbx,%rdi
call   1080 <usage@plt>
xor    %ebp,%ebp
jmp    12ef <main+0x13f>
test   %r15,%r15
je     1297 <main+0xe7>
test   %r12,%r12
je     12a9 <main+0xf9>
mov    %r15,%rbx
lea    0xe84(%rip),%rsi
mov    %r12,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12bb <main+0x10b>
mov    0x2d4c(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
jmp    12d9 <main+0x129>
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
lea    0xe25(%rip),%rsi
jmp    12d9 <main+0x129>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
lea    0xe29(%rip),%rsi
jmp    12d9 <main+0x129>
mov    0x10(%rsp),%r14
test   $0xfff,%r14d
je     1300 <main+0x150>
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
lea    0xe48(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%ebp
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdf5(%rip),%rsi
mov    %r12,%rdi
call   1060 <strcmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1334 <main+0x184>
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
mov    %r14d,%edi
mov    $0x4,%esi
call   10c0 <gen_pgtbl_x86_64@plt>
mov    %eax,%ebp
test   %eax,%eax
je     134d <main+0x19d>
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
lea    0xe00(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    12e5 <main+0x135>
lea    0xe10(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     13b2 <main+0x202>
mov    %rax,%r14
mov    0x8(%rsp),%rdi
mov    (%rsp),%rdx
mov    $0x1,%esi
mov    %rax,%rcx
call   10b0 <fwrite@plt>
cmp    (%rsp),%rax
jne    13e8 <main+0x238>
mov    %r14,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
je     1426 <main+0x276>
mov    0x2c40(%rip),%rax
mov    (%rax),%r14d
mov    0x2c2e(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xde0(%rip),%rsi
jmp    13d1 <main+0x221>
mov    0x2c1f(%rip),%rax
mov    (%rax),%r14d
mov    0x2c0d(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xd96(%rip),%rsi
xor    %ebp,%ebp
mov    %r14d,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    12e5 <main+0x135>
mov    0x2be9(%rip),%rax
mov    (%rax),%r15d
mov    0x2bd7(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xd74(%rip),%rsi
xor    %ebp,%ebp
mov    %r15d,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
jmp    12e5 <main+0x135>
xor    %ebp,%ebp
jmp    12e5 <main+0x135>

LLVM IR (-O0):
@.str = [8 x i8] c"ho:a:b:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [22 x i8] c"E: Missing filename.\0A\00"
@.str.2 = [26 x i8] c"E: Missing architecture.\0A\00"
@.str.3 = [7 x i8] c"x86_64\00"
@.str.4 = [30 x i8] c"E: Unsupported architecture.\0A\00"
@.str.5 = [35 x i8] c"E: Base address not 4 KiB aligned\0A\00"
@.str.6 = [32 x i8] c"Failed to generate page tables\0A\00"
@.str.7 = [3 x i8] c"wb\00"
@.str.8 = [20 x i8] c"%s open failed: %s\0A\00"
@errno = global i32 0
@.str.9 = [21 x i8] c"%s write failed: %s\0A\00"
@.str.10 = [21 x i8] c"%s close failed: %s\0A\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 i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 0, i32* %7
store i8* null, i8** %8
store i8* null, i8** %9
store i8* null, i8** %10
store i64 0, i64* %11
br label %14
14: ; preds = %32, %2
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i32 @getopt(i32 %15, i8** %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 %17, i32* %12
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %33
19: ; preds = %14
%20 = load i32, i32* %12
switch i32 %20, label %31 [
i32 63, label %21
i32 104, label %21
i32 111, label %24
i32 97, label %26
i32 98, label %28
]
21: ; preds = %19, %19
%22 = load i8**, i8*** %5
%23 = call i32 @usage(i8** %22)
store i32 0, i32* %3
br label %114
24: ; preds = %19
%25 = load i8*, i8** @optarg
store i8* %25, i8** %8
br label %32
26: ; preds = %19
%27 = load i8*, i8** @optarg
store i8* %27, i8** %9
br label %32
28: ; preds = %19
%29 = load i8*, i8** @optarg
%30 = call i32 @strtoull(i8* %29, i32* null, i32 0)
store i32 %30, i32* %7
br label %32
31: ; preds = %19
br label %32
32: ; preds = %31, %28, %26, %24
br label %14
33: ; preds = %14
%34 = load i8*, i8** %8
%35 = icmp ne i8* %34, null
br i1 %35, label %39, label %36
36: ; preds = %33
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %110
39: ; preds = %33
%40 = load i8*, i8** %9
%41 = icmp ne i8* %40, null
br i1 %41, label %45, label %42
42: ; preds = %39
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %110
45: ; preds = %39
%46 = load i8*, i8** %9
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load i32, i32* @stderr
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %110
52: ; preds = %45
br label %53
53: ; preds = %52
%54 = load i32, i32* %7
%55 = and i32 %54, 4095
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %53
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
br label %110
60: ; preds = %53
%61 = load i8*, i8** %9
%62 = call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %60
%65 = load i32, i32* %7
%66 = call i32 @gen_pgtbl_x86_64(i32 %65, i32 4, i8** %10, i64* %11)
store i32 %66, i32* %6
br label %67
67: ; preds = %64, %60
%68 = load i32, i32* %6
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %67
%71 = load i32, i32* @stderr
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
br label %110
73: ; preds = %67
%74 = load i8*, i8** %8
%75 = call i32* @fopen(i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i32* %75, i32** %13
%76 = load i32*, i32** %13
%77 = icmp ne i32* %76, null
br i1 %77, label %84, label %78
78: ; preds = %73
%79 = load i32, i32* @stderr
%80 = load i8*, i8** %8
%81 = load i32, i32* @errno
%82 = call i8* @strerror(i32 %81)
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %80, i8* %82)
br label %110
84: ; preds = %73
%85 = load i8*, i8** %10
%86 = load i64, i64* %11
%87 = load i32*, i32** %13
%88 = call i64 @fwrite(i8* %85, i32 1, i64 %86, i32* %87)
%89 = load i64, i64* %11
%90 = icmp ne i64 %88, %89
br i1 %90, label %91, label %99
91: ; preds = %84
%92 = load i32, i32* @stderr
%93 = load i8*, i8** %8
%94 = load i32, i32* @errno
%95 = call i8* @strerror(i32 %94)
%96 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* %93, i8* %95)
%97 = load i32*, i32** %13
%98 = call i64 @fclose(i32* %97)
br label %110
99: ; preds = %84
%100 = load i32*, i32** %13
%101 = call i64 @fclose(i32* %100)
%102 = icmp ne i64 %101, 0
br i1 %102, label %103, label %109
103: ; preds = %99
%104 = load i32, i32* @stderr
%105 = load i8*, i8** %8
%106 = load i32, i32* @errno
%107 = call i8* @strerror(i32 %106)
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %105, i8* %107)
br label %110
109: ; preds = %99
store i32 0, i32* %6
br label %110
110: ; preds = %109, %103, %91, %78, %70, %57, %49, %42, %36
%111 = load i8*, i8** %10
%112 = call i32 @free(i8* %111)
%113 = load i32, i32* %6
store i32 %113, i32* %3
br label %114
114: ; preds = %110, %21
%115 = load i32, i32* %3
ret i32 %115
}

LLVM IR (-O2):
@.str = [8 x i8] c"ho:a:b:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [22 x i8] c"E: Missing filename.\0A\00"
@.str.2 = [26 x i8] c"E: Missing architecture.\0A\00"
@.str.3 = [7 x i8] c"x86_64\00"
@.str.4 = [30 x i8] c"E: Unsupported architecture.\0A\00"
@.str.5 = [35 x i8] c"E: Base address not 4 KiB aligned\0A\00"
@.str.6 = [32 x i8] c"Failed to generate page tables\0A\00"
@.str.7 = [3 x i8] c"wb\00"
@.str.8 = [20 x i8] c"%s open failed: %s\0A\00"
@errno = global i32 0
@.str.9 = [21 x i8] c"%s write failed: %s\0A\00"
@.str.10 = [21 x i8] c"%s close failed: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = bitcast i64* %4 to i8*
store i64 0, i64* %4
br label %7
7: ; preds = %24, %2
%8 = phi i32 [ %26, %24 ], [ 0, %2 ]
%9 = phi i8* [ %12, %24 ], [ null, %2 ]
%10 = phi i8* [ %15, %24 ], [ null, %2 ]
br label %11
11: ; preds = %7, %20
%12 = phi i8* [ %9, %7 ], [ %21, %20 ]
%13 = phi i8* [ %10, %7 ], [ %15, %20 ]
br label %14
14: ; preds = %11, %22
%15 = phi i8* [ %13, %11 ], [ %23, %22 ]
br label %16
16: ; preds = %14, %16
%17 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
switch i32 %17, label %16 [
i32 -1, label %27
i32 63, label %18
i32 104, label %18
i32 111, label %20
i32 97, label %22
i32 98, label %24
]
18: ; preds = %16, %16
%19 = tail call i32 @usage(i8** %1)
br label %91
20: ; preds = %16
%21 = load i8*, i8** @optarg
br label %11
22: ; preds = %16
%23 = load i8*, i8** @optarg
br label %14
24: ; preds = %16
%25 = load i8*, i8** @optarg
%26 = tail call i32 @strtoull(i8* nocapture %25, i32* null, i32 0)
br label %7
27: ; preds = %16
%28 = icmp eq i8* %12, null
br i1 %28, label %29, label %32
29: ; preds = %27
%30 = load i32, i32* @stderr
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %87
32: ; preds = %27
%33 = icmp eq i8* %15, null
br i1 %33, label %34, label %37
34: ; preds = %32
%35 = load i32, i32* @stderr
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %87
37: ; preds = %32
%38 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = load i32, i32* @stderr
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %87
43: ; preds = %37
%44 = and i32 %8, 4095
%45 = icmp eq i32 %44, 0
br i1 %45, label %49, label %46
46: ; preds = %43
%47 = load i32, i32* @stderr
%48 = tail call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
br label %87
49: ; preds = %43
%50 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = call i32 @gen_pgtbl_x86_64(i32 %8, i32 4, i8** %3, i64* %4)
%54 = icmp eq i32 %53, 0
br i1 %54, label %59, label %55
55: ; preds = %49, %52
%56 = phi i32 [ %53, %52 ], [ 1, %49 ]
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
br label %87
59: ; preds = %52
%60 = call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%61 = icmp eq i32* %60, null
br i1 %61, label %62, label %67
62: ; preds = %59
%63 = load i32, i32* @stderr
%64 = load i32, i32* @errno
%65 = call i8* @strerror(i32 %64)
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %12, i8* %65)
br label %87
67: ; preds = %59
%68 = load i8*, i8** %3
%69 = load i64, i64* %4
%70 = call i64 @fwrite(i8* %68, i32 1, i64 %69, i32* %60)
%71 = load i64, i64* %4
%72 = icmp eq i64 %70, %71
br i1 %72, label %79, label %73
73: ; preds = %67
%74 = load i32, i32* @stderr
%75 = load i32, i32* @errno
%76 = call i8* @strerror(i32 %75)
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i8* %12, i8* %76)
%78 = call i64 @fclose(i32* %60)
br label %87
79: ; preds = %67
%80 = call i64 @fclose(i32* %60)
%81 = icmp eq i64 %80, 0
br i1 %81, label %87, label %82
82: ; preds = %79
%83 = load i32, i32* @stderr
%84 = load i32, i32* @errno
%85 = call i8* @strerror(i32 %84)
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i8* %12, i8* %85)
br label %87
87: ; preds = %79, %82, %73, %62, %55, %46, %40, %34, %29
%88 = phi i32 [ 1, %40 ], [ 1, %46 ], [ %56, %55 ], [ 0, %73 ], [ 0, %82 ], [ 0, %62 ], [ 1, %34 ], [ 1, %29 ], [ 0, %79 ]
%89 = load i8*, i8** %3
%90 = call i32 @free(i8* %89)
br label %91
91: ; preds = %87, %18
%92 = phi i32 [ 0, %18 ], [ %88, %87 ]
ret i32 %92
}