#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 void *uint64_t;
typedef void *uint32_t;
struct stat {
  int st_size;
};
typedef int off_t;

/* Variables and functions */
void *MAP_FAILED;
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ O_RDWR;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fstat(int, struct stat *);
void *mmap(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/, int,
           int /*<<< orphan*/);
int /*<<< orphan*/ munmap(void *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void *strtoul(char *, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ tolower(int);
int main(int argc, char *argv[]) {
  int priv2;
  struct stat sb;
  void *memblk, *adr;
  off_t offset;
  int type;
  uint64_t val64;
  uint32_t val32;
  if (argc < 3) {
    printf("Usage: mmio <r,w> <adr> <Region_file> [dat]\n\n");
    exit(-1);
  }
  if ((priv2 = open(argv[3], O_RDWR)) < 0) {
    printf("Can not open %s\n", argv[3]);
    exit(-1);
  }
  fstat(priv2, &sb);
  memblk = mmap(NULL, sb.st_size, PROT_WRITE | PROT_READ, MAP_SHARED, priv2, 0);
  if (memblk == MAP_FAILED) {
    printf("Can not mmap %s\n", argv[1]);
    exit(-1);
  }
  type = 0;
  if (tolower(argv[1][0] == 'd')) {
    type++;
  }
  if (argc == 5) {
    type += 2;
  }
  offset = strtoul(argv[2], 0, 0);
  adr = memblk + (offset & (sb.st_size - 1));
  switch (type) {
  case 0:
    val32 = *((uint32_t *)adr);
    printf("Reading word : [%jx]= 0x%08x\n", offset, val32);
    break;
  case 1:
    val64 = *((uint64_t *)adr);
    printf("Reading double : [%jx]= 0x%016lx\n", offset, val64);
    break;
  case 2:
    val32 = strtoul(argv[4], 0, 0);
    *((uint32_t *)adr) = val32;
    printf("Writing word : [%jx]= 0x%08x\n", offset, val32);
    break;
  case 3:
    val64 = strtoul(argv[4], 0, 0);
    *((uint64_t *)adr) = val64;
    printf("Writing double : [%jx]= 0x%016lx\n", offset, val64);
    break;
  other:
    printf("Invalid Parms\n");
    exit(-1);
    break;
  }
  munmap(memblk, sb.st_size);
  close(priv2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11c8 <main+0x38>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    0x2e01(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    120a <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   10b0 <fstat@plt>
mov    -0x18(%rbp),%esi
mov    0x2da8(%rip),%rax
mov    (%rax),%edx
mov    0x2dcf(%rip),%rax
or     (%rax),%edx
mov    0x2db6(%rip),%rax
mov    (%rax),%ecx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%edi
xor    %r9d,%r9d
call   1030 <mmap@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2d6d(%rip),%rcx
cmp    (%rcx),%rax
jne    127c <main+0xec>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x64,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <tolower@plt>
cmp    $0x0,%rax
je     12b1 <main+0x121>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x5,-0x8(%rbp)
jne    12c4 <main+0x134>
mov    -0x30(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1090 <strtoul@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
mov    -0x18(%rbp),%edx
add    $0xffffffff,%edx
and    %edx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%eax
mov    %rax,-0x48(%rbp)
sub    $0x3,%rax
ja     13cf <main+0x23f>
mov    -0x48(%rbp),%rax
lea    0xcf3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x2c(%rbp),%esi
mov    -0x40(%rbp),%rdx
lea    0xd31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13cf <main+0x23f>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%rdx
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13cf <main+0x23f>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1090 <strtoul@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x2c(%rbp),%esi
mov    -0x40(%rbp),%rdx
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13cf <main+0x23f>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1090 <strtoul@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%rdx
lea    0xcf6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1070 <munmap@plt>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jle    1311 <main+0x171>
mov    %rsi,%rbx
mov    %edi,%r13d
mov    0x18(%rsi),%rdi
mov    0x2e10(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
test   %eax,%eax
js     1327 <main+0x187>
mov    %eax,%r12d
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   10c0 <fstat@plt>
mov    0x8(%rsp),%ebp
mov    0x2dd7(%rip),%rax
mov    0x2e00(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2de5(%rip),%rax
mov    (%rax),%ecx
xor    %edi,%edi
mov    %ebp,%esi
mov    %r12d,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    0x2da5(%rip),%rcx
mov    0x8(%rbx),%rsi
mov    %rax,(%rsp)
cmp    (%rcx),%rax
je     1334 <main+0x194>
xor    %edi,%edi
cmpb   $0x64,(%rsi)
sete   %dil
call   1070 <tolower@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0x2(%rcx),%r14d
cmp    $0x5,%r13d
cmovne %ecx,%r14d
mov    0x10(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <strtoul@plt>
mov    %rax,%r15
mov    %rbp,0x10(%rsp)
lea    -0x1(%rbp),%eax
and    %r15d,%eax
movslq %eax,%r13
lea    0xd8d(%rip),%rax
movslq (%rax,%r14,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    (%rsp),%rbx
mov    (%rbx,%r13,1),%rdx
lea    0xda7(%rip),%rdi
mov    %r15d,%esi
jmp    12e4 <main+0x144>
mov    0x20(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <strtoul@plt>
mov    (%rsp),%rbx
mov    %rax,(%rbx,%r13,1)
lea    0xdc6(%rip),%rdi
jmp    12de <main+0x13e>
mov    (%rsp),%rbx
mov    (%rbx,%r13,1),%rdx
lea    0xd93(%rip),%rdi
mov    %r15d,%esi
jmp    12e4 <main+0x144>
mov    0x20(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <strtoul@plt>
mov    (%rsp),%rbx
mov    %rax,(%rbx,%r13,1)
lea    0xdb2(%rip),%rdi
mov    %r15d,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1080 <munmap@plt>
mov    %r12d,%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd9a(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x18(%rbx),%rsi
lea    0xcde(%rip),%rdi
jmp    133b <main+0x19b>
lea    0xce6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [46 x i8] c"Usage: mmio <r,w> <adr> <Region_file> [dat]\0A\0A\00"
@O_RDWR = global i32 0
@.str.1 = [17 x i8] c"Can not open %s\0A\00"
@PROT_WRITE = global i32 0
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.2 = [17 x i8] c"Can not mmap %s\0A\00"
@.str.3 = [30 x i8] c"Reading word : [%jx]= 0x%08x\0A\00"
@.str.4 = [34 x i8] c"Reading double : [%jx]= 0x%016lx\0A\00"
@.str.5 = [30 x i8] c"Writing word : [%jx]= 0x%08x\0A\00"
@.str.6 = [34 x i8] c"Writing double : [%jx]= 0x%016lx\0A\00"
@.str.7 = [15 x i8] c"Invalid Parms\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.stat
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 3
%22 = load i8*, i8** %21
%23 = load i32, i32* @O_RDWR
%24 = call i32 @open(i8* %22, i32 %23)
store i32 %24, i32* %6
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %19
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = call i32 @exit(i32 -1)
unreachable
32: ; preds = %19
%33 = load i32, i32* %6
%34 = call i32 @fstat(i32 %33, %struct.stat* %7)
%35 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%36 = load i32, i32* %35
%37 = load i32, i32* @PROT_WRITE
%38 = load i32, i32* @PROT_READ
%39 = or i32 %37, %38
%40 = load i32, i32* @MAP_SHARED
%41 = load i32, i32* %6
%42 = call i8* @mmap(i32* null, i32 %36, i32 %39, i32 %40, i32 %41, i32 0)
store i8* %42, i8** %8
%43 = load i8*, i8** %8
%44 = load i8*, i8** @MAP_FAILED
%45 = icmp eq i8* %43, %44
br i1 %45, label %46, label %52
46: ; preds = %32
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 1
%49 = load i8*, i8** %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %49)
%51 = call i32 @exit(i32 -1)
unreachable
52: ; preds = %32
store i32 0, i32* %11
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 1
%55 = load i8*, i8** %54
%56 = getelementptr inbounds i8, i8* %55, i64 0
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 100
%60 = zext i1 %59 to i32
%61 = call i64 @tolower(i32 %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %52
%64 = load i32, i32* %11
%65 = add nsw i32 %64, 1
store i32 %65, i32* %11
br label %66
66: ; preds = %63, %52
%67 = load i32, i32* %4
%68 = icmp eq i32 %67, 5
br i1 %68, label %69, label %72
69: ; preds = %66
%70 = load i32, i32* %11
%71 = add nsw i32 %70, 2
store i32 %71, i32* %11
br label %72
72: ; preds = %69, %66
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 2
%75 = load i8*, i8** %74
%76 = call i8* @strtoul(i8* %75, i32 0, i32 0)
%77 = ptrtoint i8* %76 to i32
store i32 %77, i32* %10
%78 = load i8*, i8** %8
%79 = load i32, i32* %10
%80 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%81 = load i32, i32* %80
%82 = sub nsw i32 %81, 1
%83 = and i32 %79, %82
%84 = sext i32 %83 to i64
%85 = getelementptr i8, i8* %78, i64 %84
store i8* %85, i8** %9
%86 = load i32, i32* %11
switch i32 %86, label %126 [
i32 0, label %87
i32 1, label %94
i32 2, label %101
i32 3, label %112
]
87: ; preds = %72
%88 = load i8*, i8** %9
%89 = bitcast i8* %88 to i8**
%90 = load i8*, i8** %89
store i8* %90, i8** %13
%91 = load i32, i32* %10
%92 = load i8*, i8** %13
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %91, i8* %92)
br label %126
94: ; preds = %72
%95 = load i8*, i8** %9
%96 = bitcast i8* %95 to i8**
%97 = load i8*, i8** %96
store i8* %97, i8** %12
%98 = load i32, i32* %10
%99 = load i8*, i8** %12
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %98, i8* %99)
br label %126
101: ; preds = %72
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 4
%104 = load i8*, i8** %103
%105 = call i8* @strtoul(i8* %104, i32 0, i32 0)
store i8* %105, i8** %13
%106 = load i8*, i8** %13
%107 = load i8*, i8** %9
%108 = bitcast i8* %107 to i8**
store i8* %106, i8** %108
%109 = load i32, i32* %10
%110 = load i8*, i8** %13
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %109, i8* %110)
br label %126
112: ; preds = %72
%113 = load i8**, i8*** %5
%114 = getelementptr inbounds i8*, i8** %113, i64 4
%115 = load i8*, i8** %114
%116 = call i8* @strtoul(i8* %115, i32 0, i32 0)
store i8* %116, i8** %12
%117 = load i8*, i8** %12
%118 = load i8*, i8** %9
%119 = bitcast i8* %118 to i8**
store i8* %117, i8** %119
%120 = load i32, i32* %10
%121 = load i8*, i8** %12
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i32 %120, i8* %121)
br label %126
123: ; No predecessors!
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%125 = call i32 @exit(i32 -1)
unreachable
126: ; preds = %72, %112, %101, %94, %87
%127 = load i8*, i8** %8
%128 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%129 = load i32, i32* %128
%130 = call i32 @munmap(i8* %127, i32 %129)
%131 = load i32, i32* %6
%132 = call i32 @close(i32 %131)
%133 = load i32, i32* %3
ret i32 %133
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@O_RDWR = global i32 0
@.str.1 = [17 x i8] c"Can not open %s\0A\00"
@PROT_WRITE = global i32 0
@PROT_READ = global i32 0
@MAP_SHARED = global i32 0
@MAP_FAILED = global i8* null
@.str.2 = [17 x i8] c"Can not mmap %s\0A\00"
@.str.3 = [30 x i8] c"Reading word : [%jx]= 0x%08x\0A\00"
@.str.4 = [34 x i8] c"Reading double : [%jx]= 0x%016lx\0A\00"
@.str.5 = [30 x i8] c"Writing word : [%jx]= 0x%08x\0A\00"
@.str.6 = [34 x i8] c"Writing double : [%jx]= 0x%016lx\0A\00"
@str = [45 x i8] c"Usage: mmio <r,w> <adr> <Region_file> [dat]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 3
%11 = load i8*, i8** %10
%12 = load i32, i32* @O_RDWR
%13 = tail call i32 @open(i8* %11, i32 %12)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = load i8*, i8** %10
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = tail call i32 @exit(i32 -1)
unreachable
19: ; preds = %9
%20 = call i32 @fstat(i32 %13, %struct.stat* %3)
%21 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%22 = load i32, i32* %21
%23 = load i32, i32* @PROT_WRITE
%24 = load i32, i32* @PROT_READ
%25 = or i32 %24, %23
%26 = load i32, i32* @MAP_SHARED
%27 = tail call i8* @mmap(i32* null, i32 %22, i32 %25, i32 %26, i32 %13, i32 0)
%28 = load i8*, i8** @MAP_FAILED
%29 = icmp eq i8* %27, %28
%30 = getelementptr inbounds i8*, i8** %1, i64 1
%31 = load i8*, i8** %30
br i1 %29, label %32, label %35
32: ; preds = %19
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%34 = tail call i32 @exit(i32 -1)
unreachable
35: ; preds = %19
%36 = load i8, i8* %31
%37 = icmp eq i8 %36, 100
%38 = zext i1 %37 to i32
%39 = tail call i64 @tolower(i32 %38)
%40 = icmp ne i64 %39, 0
%41 = zext i1 %40 to i32
%42 = icmp eq i32 %0, 5
%43 = or i32 %41, 2
%44 = select i1 %42, i32 %43, i32 %41
%45 = getelementptr inbounds i8*, i8** %1, i64 2
%46 = load i8*, i8** %45
%47 = tail call i8* @strtoul(i8* %46, i32 0, i32 0)
%48 = ptrtoint i8* %47 to i64
%49 = trunc i64 %48 to i32
%50 = add nsw i32 %22, -1
%51 = and i32 %50, %49
%52 = sext i32 %51 to i64
%53 = getelementptr i8, i8* %27, i64 %52
switch i32 %44, label %74 [
i32 0, label %54
i32 1, label %58
i32 2, label %62
i32 3, label %68
]
54: ; preds = %35
%55 = bitcast i8* %53 to i8**
%56 = load i8*, i8** %55
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %49, i8* %56)
br label %75
58: ; preds = %35
%59 = bitcast i8* %53 to i8**
%60 = load i8*, i8** %59
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %49, i8* %60)
br label %75
62: ; preds = %35
%63 = getelementptr inbounds i8*, i8** %1, i64 4
%64 = load i8*, i8** %63
%65 = tail call i8* @strtoul(i8* %64, i32 0, i32 0)
%66 = bitcast i8* %53 to i8**
store i8* %65, i8** %66
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %49, i8* %65)
br label %75
68: ; preds = %35
%69 = getelementptr inbounds i8*, i8** %1, i64 4
%70 = load i8*, i8** %69
%71 = tail call i8* @strtoul(i8* %70, i32 0, i32 0)
%72 = bitcast i8* %53 to i8**
store i8* %71, i8** %72
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i32 %49, i8* %71)
br label %75
74: ; preds = %35
unreachable
75: ; preds = %68, %62, %58, %54
%76 = tail call i32 @munmap(i8* %27, i32 %22)
%77 = tail call i32 @close(i32 %13)
ret i32 0
}