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

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fread(char *, int, long long, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long long, int /*<<< orphan*/);
int /*<<< orphan*/ fwrite(char *, int, long long, int /*<<< orphan*/ *);
scalar_t__ malloc(long long);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, void *, void *, int);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
scalar_t__ strstr(char *, char const *);
long long strtoll(char *, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  char buf[256], *mem;
  const char *range_name;
  FILE *rd, *wr;
  long long start_addr, end_addr;
  if (argc != 3) {
    fprintf(stderr,
            "Usage: %s <file> <string>\n"
            "\t<file>:   File to write the vdso data to.\n"
            "\t<string>: Name of the mapped in region, e.g. vdso\n",
            argv[0]);
    abort();
  }
  range_name = argv[2];
  if (!(wr = fopen(argv[1], "w"))) {
    perror("Error: fopen() - output file");
    abort();
  }
  if (!(rd = fopen("/proc/self/maps", "r"))) {
    perror("Error: fopen() - /proc/self/maps");
    abort();
  }
  while (fgets(buf, sizeof(buf), rd)) {
    if (strstr(buf, range_name))
      break;
  }
  fclose(rd);
  end_addr = strtoll((strchr(buf, '-') + 1), NULL, 16);
  *(strchr(buf, '-')) = '\0';
  start_addr = strtoll(buf, NULL, 16);
  if (!(rd = fopen("/proc/self/mem", "r"))) {
    perror("Error: fopen() - /proc/self/mem");
    abort();
  }
  fseek(rd, start_addr, SEEK_SET);
  mem = (char *)malloc(end_addr - start_addr);
  if (!fread(mem, 1, end_addr - start_addr, rd)) {
    perror("Error: read() - /proc/self/mem");
    abort();
  }
  if (!fwrite(mem, 1, end_addr - start_addr, wr)) {
    perror("Error: fwrite() - output file");
    abort();
  }
  free(mem);
  fclose(rd);
  fclose(wr);
  printf("Start: %p\nEnd:   %p\nBytes: %d\n", (void *)start_addr,
         (void *)end_addr, (int)(end_addr - start_addr));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1236 <main+0x46>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd6(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x120(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe25(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x130(%rbp)
cmp    $0x0,%rax
jne    127d <main+0x8d>
lea    0xe0a(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
lea    0xe27(%rip),%rdi
lea    0xe0d(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x128(%rbp)
cmp    $0x0,%rax
jne    12b4 <main+0xc4>
lea    0xdf2(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    12b9 <main+0xc9>
lea    -0x110(%rbp),%rdi
mov    -0x128(%rbp),%rdx
mov    $0x100,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     1302 <main+0x112>
lea    -0x110(%rbp),%rdi
mov    -0x120(%rbp),%rsi
call   1110 <strstr@plt>
cmp    $0x0,%rax
je     12fd <main+0x10d>
jmp    1302 <main+0x112>
jmp    12b9 <main+0xc9>
mov    -0x128(%rbp),%rdi
call   1060 <fclose@plt>
lea    -0x110(%rbp),%rdi
mov    $0x2d,%esi
call   1070 <strchr@plt>
mov    %rax,%rdi
add    $0x1,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   10a0 <strtoll@plt>
mov    %rax,-0x140(%rbp)
lea    -0x110(%rbp),%rdi
mov    $0x2d,%esi
call   1070 <strchr@plt>
movb   $0x0,(%rax)
lea    -0x110(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   10a0 <strtoll@plt>
mov    %rax,-0x138(%rbp)
lea    0xd79(%rip),%rdi
lea    0xd1f(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x128(%rbp)
cmp    $0x0,%rax
jne    13a2 <main+0x1b2>
lea    0xd25(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x128(%rbp),%rdi
mov    -0x138(%rbp),%rsi
mov    0x2c21(%rip),%rax
mov    (%rax),%edx
call   10d0 <fseek@plt>
mov    -0x140(%rbp),%rdi
sub    -0x138(%rbp),%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x118(%rbp)
mov    -0x118(%rbp),%rdi
mov    -0x140(%rbp),%rdx
sub    -0x138(%rbp),%rdx
mov    -0x128(%rbp),%rcx
mov    $0x1,%esi
call   1050 <fread@plt>
cmp    $0x0,%eax
jne    141a <main+0x22a>
lea    0xccd(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x118(%rbp),%rdi
mov    -0x140(%rbp),%rdx
sub    -0x138(%rbp),%rdx
mov    -0x130(%rbp),%rcx
mov    $0x1,%esi
call   1100 <fwrite@plt>
cmp    $0x0,%eax
jne    145c <main+0x26c>
lea    0xcaa(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x118(%rbp),%rdi
call   1030 <free@plt>
mov    -0x128(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x130(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x138(%rbp),%rsi
mov    -0x140(%rbp),%rdx
mov    -0x140(%rbp),%rax
sub    -0x138(%rbp),%rax
mov    %eax,%ecx
lea    0xc73(%rip),%rdi
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
cmp    $0x3,%edi
jne    137c <main+0x18c>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%r15
lea    0xe60(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     139b <main+0x1ab>
mov    %rax,%r14
lea    0xe7a(%rip),%rdi
lea    0xe60(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     13a4 <main+0x1b4>
mov    %rax,%rbx
mov    %rsp,%rbp
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    $0x100,%esi
mov    %rbx,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     1275 <main+0x85>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1110 <strstr@plt>
test   %rax,%rax
je     1250 <main+0x60>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x2d,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <strtoll@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    $0x2d,%esi
call   1070 <strchr@plt>
movb   $0x0,(%rax)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <strtoll@plt>
mov    %rax,%r12
lea    0xe22(%rip),%rdi
lea    0xdc8(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     13ad <main+0x1bd>
mov    %rax,%r13
mov    0x2cf0(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
mov    %r12,%rsi
call   10d0 <fseek@plt>
mov    %r15,%rbx
sub    %r12,%rbx
mov    %rbx,%rdi
call   10c0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %r13,%rcx
call   1050 <fread@plt>
test   %eax,%eax
je     13b6 <main+0x1c6>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1100 <fwrite@plt>
test   %eax,%eax
je     13bf <main+0x1cf>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
lea    0xdbd(%rip),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %ebx,%ecx
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xc71(%rip),%rsi
call   10b0 <fprintf@plt>
xor    %eax,%eax
call   1040 <abort@plt>
lea    0xcd9(%rip),%rdi
jmp    13c6 <main+0x1d6>
lea    0xcef(%rip),%rdi
jmp    13c6 <main+0x1d6>
lea    0xd07(%rip),%rdi
jmp    13c6 <main+0x1d6>
lea    0xd1e(%rip),%rdi
jmp    13c6 <main+0x1d6>
lea    0xd34(%rip),%rdi
call   10f0 <perror@plt>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [121 x i8] c"Usage: %s <file> <string>\0A\09<file>: File to write the vdso data to.\0A\09<string>: Name of the mapped in region, e.g. vdso\0A\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [29 x i8] c"Error: fopen() - output file\00"
@.str.3 = [16 x i8] c"/proc/self/maps\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [33 x i8] c"Error: fopen() - /proc/self/maps\00"
@.str.6 = [15 x i8] c"/proc/self/mem\00"
@.str.7 = [32 x i8] c"Error: fopen() - /proc/self/mem\00"
@SEEK_SET = global i32 0
@.str.8 = [31 x i8] c"Error: read() - /proc/self/mem\00"
@.str.9 = [30 x i8] c"Error: fwrite() - output file\00"
@.str.10 = [31 x i8] c"Start: %p\0AEnd: %p\0ABytes: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i64
%12 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
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 @fprintf(i32 %16, i8* getelementptr inbounds ([121 x i8], [121 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = call i32 (...) @abort()
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
store i8* %25, i8** %8
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %29, i32** %10
%30 = icmp ne i32* %29, null
br i1 %30, label %34, label %31
31: ; preds = %22
%32 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%33 = call i32 (...) @abort()
unreachable
34: ; preds = %22
%35 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %35, i32** %9
%36 = icmp ne i32* %35, null
br i1 %36, label %40, label %37
37: ; preds = %34
%38 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%39 = call i32 (...) @abort()
unreachable
40: ; preds = %34
br label %41
41: ; preds = %52, %40
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%43 = load i32*, i32** %9
%44 = call i64 @fgets(i8* %42, i32 256, i32* %43)
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %53
46: ; preds = %41
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%48 = load i8*, i8** %8
%49 = call i64 @strstr(i8* %47, i8* %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %46
br label %53
52: ; preds = %46
br label %41
53: ; preds = %51, %41
%54 = load i32*, i32** %9
%55 = call i32 @fclose(i32* %54)
%56 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%57 = call i8* @strchr(i8* %56, i8 signext 45)
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = call i64 @strtoll(i8* %58, i32* null, i32 16)
store i64 %59, i64* %12
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%61 = call i8* @strchr(i8* %60, i8 signext 45)
store i8 0, i8* %61
%62 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%63 = call i64 @strtoll(i8* %62, i32* null, i32 16)
store i64 %63, i64* %11
%64 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %64, i32** %9
%65 = icmp ne i32* %64, null
br i1 %65, label %69, label %66
66: ; preds = %53
%67 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%68 = call i32 (...) @abort()
unreachable
69: ; preds = %53
%70 = load i32*, i32** %9
%71 = load i64, i64* %11
%72 = load i32, i32* @SEEK_SET
%73 = call i32 @fseek(i32* %70, i64 %71, i32 %72)
%74 = load i64, i64* %12
%75 = load i64, i64* %11
%76 = sub nsw i64 %74, %75
%77 = call i64 @malloc(i64 %76)
%78 = inttoptr i64 %77 to i8*
store i8* %78, i8** %7
%79 = load i8*, i8** %7
%80 = load i64, i64* %12
%81 = load i64, i64* %11
%82 = sub nsw i64 %80, %81
%83 = load i32*, i32** %9
%84 = call i32 @fread(i8* %79, i32 1, i64 %82, i32* %83)
%85 = icmp ne i32 %84, 0
br i1 %85, label %89, label %86
86: ; preds = %69
%87 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%88 = call i32 (...) @abort()
unreachable
89: ; preds = %69
%90 = load i8*, i8** %7
%91 = load i64, i64* %12
%92 = load i64, i64* %11
%93 = sub nsw i64 %91, %92
%94 = load i32*, i32** %10
%95 = call i32 @fwrite(i8* %90, i32 1, i64 %93, i32* %94)
%96 = icmp ne i32 %95, 0
br i1 %96, label %100, label %97
97: ; preds = %89
%98 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%99 = call i32 (...) @abort()
unreachable
100: ; preds = %89
%101 = load i8*, i8** %7
%102 = call i32 @free(i8* %101)
%103 = load i32*, i32** %9
%104 = call i32 @fclose(i32* %103)
%105 = load i32*, i32** %10
%106 = call i32 @fclose(i32* %105)
%107 = load i64, i64* %11
%108 = inttoptr i64 %107 to i8*
%109 = load i64, i64* %12
%110 = inttoptr i64 %109 to i8*
%111 = load i64, i64* %12
%112 = load i64, i64* %11
%113 = sub nsw i64 %111, %112
%114 = trunc i64 %113 to i32
%115 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i8* %108, i8* %110, i32 %114)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [121 x i8] c"Usage: %s <file> <string>\0A\09<file>: File to write the vdso data to.\0A\09<string>: Name of the mapped in region, e.g. vdso\0A\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [29 x i8] c"Error: fopen() - output file\00"
@.str.3 = [16 x i8] c"/proc/self/maps\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [33 x i8] c"Error: fopen() - /proc/self/maps\00"
@.str.6 = [15 x i8] c"/proc/self/mem\00"
@.str.7 = [32 x i8] c"Error: fopen() - /proc/self/mem\00"
@SEEK_SET = global i32 0
@.str.8 = [31 x i8] c"Error: read() - /proc/self/mem\00"
@.str.9 = [30 x i8] c"Error: fwrite() - output file\00"
@.str.10 = [31 x i8] c"Start: %p\0AEnd: %p\0ABytes: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([121 x i8], [121 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 (...) @abort()
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = tail call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%20 = tail call i32 (...) @abort()
unreachable
21: ; preds = %11
%22 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = tail call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%26 = tail call i32 (...) @abort()
unreachable
27: ; preds = %21, %30
%28 = call i64 @fgets(i8* %4, i32 256, i32* %22)
%29 = icmp eq i64 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = call i64 @strstr(i8* %4, i8* %13)
%32 = icmp eq i64 %31, 0
br i1 %32, label %27, label %33
33: ; preds = %30, %27
%34 = call i32 @fclose(i32* %22)
%35 = call i8* @strchr(i8* %4, i8 signext 45)
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = call i64 @strtoll(i8* nocapture %36, i32* null, i32 16)
%38 = call i8* @strchr(i8* %4, i8 signext 45)
store i8 0, i8* %38
%39 = call i64 @strtoll(i8* nocapture %4, i32* null, i32 16)
%40 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %45
42: ; preds = %33
%43 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%44 = call i32 (...) @abort()
unreachable
45: ; preds = %33
%46 = load i32, i32* @SEEK_SET
%47 = call i32 @fseek(i32* %40, i64 %39, i32 %46)
%48 = sub nsw i64 %37, %39
%49 = call i64 @malloc(i64 %48)
%50 = inttoptr i64 %49 to i8*
%51 = call i32 @fread(i8* %50, i32 1, i64 %48, i32* %40)
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %45
%54 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
%55 = call i32 (...) @abort()
unreachable
56: ; preds = %45
%57 = call i32 @fwrite(i8* %50, i32 1, i64 %48, i32* %16)
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%61 = call i32 (...) @abort()
unreachable
62: ; preds = %56
%63 = call i32 @free(i8* %50)
%64 = call i32 @fclose(i32* %40)
%65 = call i32 @fclose(i32* %16)
%66 = inttoptr i64 %39 to i8*
%67 = inttoptr i64 %37 to i8*
%68 = trunc i64 %48 to i32
%69 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i8* %66, i8* %67, i32 %68)
ret i32 0
}