#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ MAP_SHARED;
int /*<<< orphan*/ O_RDWR;
int PROT_READ;
int PROT_WRITE;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ mmap(int /*<<< orphan*/, int, int, int /*<<< orphan*/, int,
                unsigned int);
int open(char *, int /*<<< orphan*/);
scalar_t__ pipe(int *);
int /*<<< orphan*/ printf(char *, int volatile);
int read(int, char *, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int strtol(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int write(int, int *, int);
int main(int argc, char **argv) {
  if (argc < 2) {
    fprintf(stderr, "usage: %s <gpio> <mode>\n", argv[0]);
    exit(1);
  }
  int pin = strtol(argv[1], NULL, 0);
  int devmem = open("/dev/mem", O_RDWR);
  unsigned pad_control_base = 0x44e10000;
  volatile uint32_t *padmap = (volatile uint32_t *)mmap(
      0, 0x2000, PROT_READ | PROT_WRITE, MAP_SHARED, devmem, pad_control_base);
  int pad_offset[32 * 4] = {
      0x148, 0x14c, 0x150, 0x154, 0x158, 0x15c, 0x160, 0x164, 0xd0,  0xd4,
      0xd8,  0xdc,  0x178, 0x17c, 0x180, 0x184, 0x11c, 0x120, 0x21c, 0x1b0,
      0x1b4, 0x124, 0x20,  0x24,  -1,    -1,    0x28,  0x2c,  0x128, 0x144,
      0x70,  0x74,  0x0,   0x4,   0x8,   0xc,   0x10,  0x14,  0x18,  0x1c,
      0x168, 0x16c, 0x170, 0x174, 0x30,  0x34,  0x38,  0x3c,  0x40,  0x44,
      0x48,  0x4c,  0x50,  0x54,  0x58,  0x5c,  0x60,  0x64,  0x68,  0x6c,
      0x78,  0x7c,  0x80,  0x84,  0x88,  0x8c,  0x90,  0x94,  0x98,  0x9c,
      0xa0,  0xa4,  0xa8,  0xac,  0xb0,  0xb4,  0xb8,  0xbc,  0xc0,  0xc4,
      0xc8,  0xcc,  0x134, 0x138, 0x13c, 0x140, 0xe0,  0xe4,  0xe8,  0xec,
      0xf0,  0xf4,  0xf8,  0xfc,  0x100, 0x104, 0x108, 0x10c, 0x110, 0x114,
      0x118, 0x188, 0x18c, 0x1e4, 0x1e8, 0x12c, 0x130, -1,    -1,    0x234,
      0x190, 0x194, 0x198, 0x19c, 0x1a0, 0x1a4, 0x1a8, 0x1ac, -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1};
  if (pad_offset[pin] < 0) {
    fprintf(stderr, "invalid pin %d\n", pin);
    exit(1);
  }
  printf("current: %x\n", padmap[(0x800 + pad_offset[pin]) / 4]);
  if (argc >= 2) {
    int mode = strtol(argv[2], NULL, 0);
    int hack[2];
    if (pipe(hack)) {
      fprintf(stderr, "unable to create pipe: %s\n", strerror(errno));
      exit(1);
    }
    if (write(hack[1], &mode, 4) != 4)
      fprintf(stderr, "warning: short write\n");
    if (read(hack[0], (char *)&padmap[(0x800 + pad_offset[pin]) / 4], 4) != 4)
      fprintf(stderr, "warning: short read\n");
    printf("new: %x\n", padmap[(0x800 + pad_offset[pin]) / 4]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11fb <main+0x4b>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe16(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    0x2dc0(%rip),%rax
mov    (%rax),%esi
lea    0xdf8(%rip),%rdi
call   10b0 <open@plt>
mov    %eax,-0x18(%rbp)
movl   $0x44e10000,-0x1c(%rbp)
mov    0x2dc1(%rip),%rax
mov    (%rax),%edx
mov    0x2d78(%rip),%rax
or     (%rax),%edx
mov    0x2d9f(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
xor    %edi,%edi
mov    $0x2000,%esi
call   1040 <mmap@plt>
mov    %rax,-0x28(%rbp)
lea    -0x230(%rbp),%rdi
lea    0xe1f(%rip),%rsi
mov    $0x200,%edx
call   10a0 <memcpy@plt>
movslq -0x14(%rbp),%rax
cmpl   $0x0,-0x230(%rbp,%rax,4)
jge    12b1 <main+0x101>
mov    0x2d34(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xd82(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x248(%rbp)
movslq -0x14(%rbp),%rax
mov    -0x230(%rbp,%rax,4),%eax
add    $0x800,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x248(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd48(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jl     1430 <main+0x280>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,-0x234(%rbp)
lea    -0x23c(%rbp),%rdi
call   1060 <pipe@plt>
cmp    $0x0,%rax
je     1366 <main+0x1b6>
mov    0x2c99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24c(%rbp)
mov    0x2c82(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x24c(%rbp),%edi
mov    %rax,%rdx
lea    0xcea(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x238(%rbp),%edi
lea    -0x234(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cmp    $0x4,%eax
je     139d <main+0x1ed>
mov    0x2c3b(%rip),%rax
mov    (%rax),%edi
lea    0xcc4(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x23c(%rbp),%edi
mov    -0x28(%rbp),%rsi
movslq -0x14(%rbp),%rax
mov    -0x230(%rbp,%rax,4),%eax
add    $0x800,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cltq
shl    $0x2,%rax
add    %rax,%rsi
mov    $0x4,%edx
call   1070 <read@plt>
cmp    $0x4,%eax
je     13f2 <main+0x242>
mov    0x2be6(%rip),%rax
mov    (%rax),%edi
lea    0xc85(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x258(%rbp)
movslq -0x14(%rbp),%rax
mov    -0x230(%rbp,%rax,4),%eax
add    $0x800,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x258(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xc5a(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
cmp    $0x1,%edi
jle    12db <main+0x13b>
mov    0x8(%r14),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,%r15d
mov    0x2e0b(%rip),%rax
mov    (%rax),%esi
lea    0xe43(%rip),%rdi
call   10a0 <open@plt>
mov    0x2e16(%rip),%rcx
mov    0x2dcf(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2df4(%rip),%rcx
mov    (%rcx),%ecx
xor    %edi,%edi
mov    $0x2000,%esi
mov    %eax,%r8d
mov    $0x44e10000,%r9d
call   1040 <mmap@plt>
mov    %rax,%rbx
movslq %r15d,%rax
lea    0xe78(%rip),%rcx
mov    (%rcx,%rax,4),%ebp
test   %ebp,%ebp
js     12f0 <main+0x150>
add    $0x800,%rbp
and    $0xfffffffffffffffc,%rbp
mov    (%rbx,%rbp,1),%esi
lea    0xdfa(%rip),%rdi
call   1050 <printf@plt>
mov    0x10(%r14),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,0xc(%rsp)
lea    0x10(%rsp),%rdi
call   1060 <pipe@plt>
test   %rax,%rax
jne    1314 <main+0x174>
add    %rbp,%rbx
mov    0x14(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cmp    $0x4,%eax
je     1293 <main+0xf3>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
lea    0xdce(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x10(%rsp),%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1070 <read@plt>
cmp    $0x4,%eax
je     12c0 <main+0x120>
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
lea    0xdb7(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rbx),%esi
lea    0xdbc(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xd12(%rip),%rsi
jmp    1337 <main+0x197>
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
lea    0xd22(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    0x2cad(%rip),%rax
mov    (%rax),%ebx
mov    0x2c9c(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd0d(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"usage: %s <gpio> <mode>\0A\00"
@.str.1 = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@__const.main.pad_offset = [128 x i32] [i32 328, i32 332, i32 336, i32 340, i32 344, i32 348, i32 352, i32 356, i32 208, i32 212, i32 216, i32 220, i32 376, i32 380, i32 384, i32 388, i32 284, i32 288, i32 540, i32 432, i32 436, i32 292, i32 32, i32 36, i32 -1, i32 -1, i32 40, i32 44, i32 296, i32 324, i32 112, i32 116, i32 0, i32 4, i32 8, i32 12, i32 16, i32 20, i32 24, i32 28, i32 360, i32 364, i32 368, i32 372, i32 48, i32 52, i32 56, i32 60, i32 64, i32 68, i32 72, i32 76, i32 80, i32 84, i32 88, i32 92, i32 96, i32 100, i32 104, i32 108, i32 120, i32 124, i32 128, i32 132, i32 136, i32 140, i32 144, i32 148, i32 152, i32 156, i32 160, i32 164, i32 168, i32 172, i32 176, i32 180, i32 184, i32 188, i32 192, i32 196, i32 200, i32 204, i32 308, i32 312, i32 316, i32 320, i32 224, i32 228, i32 232, i32 236, i32 240, i32 244, i32 248, i32 252, i32 256, i32 260, i32 264, i32 268, i32 272, i32 276, i32 280, i32 392, i32 396, i32 484, i32 488, i32 300, i32 304, i32 -1, i32 -1, i32 564, i32 400, i32 404, i32 408, i32 412, i32 416, i32 420, i32 424, i32 428, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1]
@.str.2 = [16 x i8] c"invalid pin %d\0A\00"
@.str.3 = [13 x i8] c"current: %x\0A\00"
@.str.4 = [27 x i8] c"unable to create pipe: %s\0A\00"
@errno = global i32 0
@.str.5 = [22 x i8] c"warning: short write\0A\00"
@.str.6 = [21 x i8] c"warning: short read\0A\00"
@.str.7 = [9 x i8] c"new: %x\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 i32
%9 = alloca i32*
%10 = alloca [128 x i32]
%11 = alloca i32
%12 = alloca [2 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %22
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strtol(i8* %25, i32* null, i32 0)
store i32 %26, i32* %6
%27 = load i32, i32* @O_RDWR
%28 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 %28, i32* %7
store i32 1155596288, i32* %8
%29 = load i32, i32* @PROT_READ
%30 = load i32, i32* @PROT_WRITE
%31 = or i32 %29, %30
%32 = load i32, i32* @MAP_SHARED
%33 = load i32, i32* %7
%34 = load i32, i32* %8
%35 = call i64 @mmap(i32 0, i32 8192, i32 %31, i32 %32, i32 %33, i32 %34)
%36 = inttoptr i64 %35 to i32*
store i32* %36, i32** %9
%37 = bitcast [128 x i32]* %10 to i8*
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [128 x i32], [128 x i32]* %10, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %22
%44 = load i32, i32* @stderr
%45 = load i32, i32* %6
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %45)
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %22
%49 = load i32*, i32** %9
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [128 x i32], [128 x i32]* %10, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = add nsw i32 2048, %53
%55 = sdiv i32 %54, 4
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %49, i64 %56
%58 = load volatile i32, i32* %57
%59 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %58)
%60 = load i32, i32* %4
%61 = icmp sge i32 %60, 2
br i1 %61, label %62, label %114
62: ; preds = %48
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 2
%65 = load i8*, i8** %64
%66 = call i32 @strtol(i8* %65, i32* null, i32 0)
store i32 %66, i32* %11
%67 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%68 = call i64 @pipe(i32* %67)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %76
70: ; preds = %62
%71 = load i32, i32* @stderr
%72 = load i32, i32* @errno
%73 = call i8* @strerror(i32 %72)
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %73)
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %62
%77 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%78 = load i32, i32* %77
%79 = call i32 @write(i32 %78, i32* %11, i32 4)
%80 = icmp ne i32 %79, 4
br i1 %80, label %81, label %84
81: ; preds = %76
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %84
84: ; preds = %81, %76
%85 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%86 = load i32, i32* %85
%87 = load i32*, i32** %9
%88 = load i32, i32* %6
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [128 x i32], [128 x i32]* %10, i64 0, i64 %89
%91 = load i32, i32* %90
%92 = add nsw i32 2048, %91
%93 = sdiv i32 %92, 4
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i32, i32* %87, i64 %94
%96 = bitcast i32* %95 to i8*
%97 = call i32 @read(i32 %86, i8* %96, i32 4)
%98 = icmp ne i32 %97, 4
br i1 %98, label %99, label %102
99: ; preds = %84
%100 = load i32, i32* @stderr
%101 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %102
102: ; preds = %99, %84
%103 = load i32*, i32** %9
%104 = load i32, i32* %6
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [128 x i32], [128 x i32]* %10, i64 0, i64 %105
%107 = load i32, i32* %106
%108 = add nsw i32 2048, %107
%109 = sdiv i32 %108, 4
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i32, i32* %103, i64 %110
%112 = load volatile i32, i32* %111
%113 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %112)
br label %114
114: ; preds = %102, %48
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"usage: %s <gpio> <mode>\0A\00"
@.str.1 = [9 x i8] c"/dev/mem\00"
@O_RDWR = global i32 0
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_SHARED = global i32 0
@__const.main.pad_offset = [128 x i32] [i32 328, i32 332, i32 336, i32 340, i32 344, i32 348, i32 352, i32 356, i32 208, i32 212, i32 216, i32 220, i32 376, i32 380, i32 384, i32 388, i32 284, i32 288, i32 540, i32 432, i32 436, i32 292, i32 32, i32 36, i32 -1, i32 -1, i32 40, i32 44, i32 296, i32 324, i32 112, i32 116, i32 0, i32 4, i32 8, i32 12, i32 16, i32 20, i32 24, i32 28, i32 360, i32 364, i32 368, i32 372, i32 48, i32 52, i32 56, i32 60, i32 64, i32 68, i32 72, i32 76, i32 80, i32 84, i32 88, i32 92, i32 96, i32 100, i32 104, i32 108, i32 120, i32 124, i32 128, i32 132, i32 136, i32 140, i32 144, i32 148, i32 152, i32 156, i32 160, i32 164, i32 168, i32 172, i32 176, i32 180, i32 184, i32 188, i32 192, i32 196, i32 200, i32 204, i32 308, i32 312, i32 316, i32 320, i32 224, i32 228, i32 232, i32 236, i32 240, i32 244, i32 248, i32 252, i32 256, i32 260, i32 264, i32 268, i32 272, i32 276, i32 280, i32 392, i32 396, i32 484, i32 488, i32 300, i32 304, i32 -1, i32 -1, i32 564, i32 400, i32 404, i32 408, i32 412, i32 416, i32 420, i32 424, i32 428, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1]
@.str.2 = [16 x i8] c"invalid pin %d\0A\00"
@.str.3 = [13 x i8] c"current: %x\0A\00"
@.str.4 = [27 x i8] c"unable to create pipe: %s\0A\00"
@errno = global i32 0
@.str.5 = [22 x i8] c"warning: short write\0A\00"
@.str.6 = [21 x i8] c"warning: short read\0A\00"
@.str.7 = [9 x i8] c"new: %x\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [2 x i32]
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @strtol(i8* nocapture %13, i32* null, i32 0)
%15 = load i32, i32* @O_RDWR
%16 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32, i32* @PROT_READ
%18 = load i32, i32* @PROT_WRITE
%19 = or i32 %18, %17
%20 = load i32, i32* @MAP_SHARED
%21 = tail call i64 @mmap(i32 0, i32 8192, i32 %19, i32 %20, i32 %16, i32 1155596288)
%22 = sext i32 %14 to i64
%23 = getelementptr inbounds [128 x i32], [128 x i32]* @__const.main.pad_offset, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %11
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %11
%31 = inttoptr i64 %21 to i32*
%32 = add nuw nsw i32 %24, 2048
%33 = lshr i32 %32, 2
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %31, i64 %34
%36 = load volatile i32, i32* %35
%37 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = bitcast i32* %3 to i8*
%39 = getelementptr inbounds i8*, i8** %1, i64 2
%40 = load i8*, i8** %39
%41 = tail call i32 @strtol(i8* nocapture %40, i32* null, i32 0)
store i32 %41, i32* %3
%42 = bitcast [2 x i32]* %4 to i8*
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%44 = call i64 @pipe(i32* %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %52, label %46
46: ; preds = %30
%47 = load i32, i32* @stderr
%48 = load i32, i32* @errno
%49 = call i8* @strerror(i32 %48)
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8* %49)
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %30
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%54 = load i32, i32* %53
%55 = call i32 @write(i32 %54, i32* %3, i32 4)
%56 = icmp eq i32 %55, 4
br i1 %56, label %60, label %57
57: ; preds = %52
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %60
60: ; preds = %57, %52
%61 = load i32, i32* %43
%62 = bitcast i32* %35 to i8*
%63 = call i32 @read(i32 %61, i8* %62, i32 4)
%64 = icmp eq i32 %63, 4
br i1 %64, label %68, label %65
65: ; preds = %60
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %68
68: ; preds = %65, %60
%69 = load volatile i32, i32* %35
%70 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i32 %69)
ret i32 0
}