#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*/ uid_t;
typedef scalar_t__ ssize_t;
typedef scalar_t__ off_t;
typedef int /*<<< orphan*/ gid_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int O_CREAT;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fatal(char *, ...);
int fchmod(int, int);
int fchown(int, int /*<<< orphan*/, int /*<<< orphan*/);
char *format(char *, char const *);
int ftruncate(int, scalar_t__);
int /*<<< orphan*/ getegid();
int /*<<< orphan*/ geteuid();
scalar_t__ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ memcmp(char *, char *, scalar_t__);
int open(char const *, int, int /*<<< orphan*/);
scalar_t__ read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ to_gid(char *);
int /*<<< orphan*/ to_uid(int /*<<< orphan*/ *);
int /*<<< orphan*/ warning(char *, ...);
scalar_t__ write(int, char *, scalar_t__);
void generate_coredump(const char *tag) {
  const char *path;
  int fd;
  char buf[65536];
  char zero[sizeof buf] = {0};
  ssize_t nread;
  ssize_t nwrite;
  off_t off;
  uid_t uid;
  gid_t gid;
  path = format("/var/crash_reports"
                "/"
                "core"
                "__"
                "%s",
                tag);
  fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0);
  if (fd == -1) {
    warning("%s: cannot open coredump file", path);
    return;
  }
  uid = NULL == NULL ? geteuid() : to_uid(NULL);
  gid = "gr_crash_reports" == NULL ? getegid() : to_gid("gr_crash_reports");
  if (fchown(fd, uid, gid) == -1)
    fatal("%s: fchown %d:%d\n", path, uid, gid);
  if (fchmod(fd, 0640) == -1)
    fatal("%s: fchmod %o", 0640);
  while ((nread = read(STDIN_FILENO, buf, sizeof(buf))) > 0) {
    if (memcmp(buf, zero, nread) == 0) {
      off = lseek(fd, 0, SEEK_END);
      if (off == (off_t)-1) {
        warning("%s: lseek", path);
        break;
      }
      if (ftruncate(fd, off + nread) == -1) {
        warning("%s: ftruncate", path);
        break;
      }
      off = lseek(fd, 0, SEEK_END);
      if (off == (off_t)-1) {
        warning("%s: lseek", path);
        break;
      }
      continue;
    }
    nwrite = write(fd, buf, nread);
    if (nwrite < 0) {
      warning("failed to write coredump data");
      break;
    } else if (nwrite != nread) {
      warning("failed to write coredump data: short write, %d of %d", nwrite,
              nread);
      break;
    }
  }
  if (nread < 0)
    warning("failed to read coredump data from pipe");
  close(fd);
}


x86 assembly (clang, -O0):
<generate_coredump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20040,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20020(%rbp),%rdi
xor    %esi,%esi
mov    $0x10000,%edx
call   1070 <memset@plt>
mov    -0x8(%rbp),%rsi
lea    0xde3(%rip),%rdi
call   10c0 <format@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2dc7(%rip),%rax
mov    (%rax),%esi
mov    0x2db6(%rip),%rax
or     (%rax),%esi
mov    0x2d75(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   10e0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1270 <generate_coredump+0x80>
mov    -0x10(%rbp),%rsi
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1030 <warning@plt>
jmp    14a1 <generate_coredump+0x2b1>
mov    $0x0,%al
call   1080 <geteuid@plt>
mov    %eax,-0x2003c(%rbp)
lea    0xdb6(%rip),%rdi
call   1100 <to_gid@plt>
mov    %eax,-0x20040(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x2003c(%rbp),%esi
mov    -0x20040(%rbp),%edx
call   10f0 <fchown@plt>
cmp    $0xffffffff,%eax
jne    12ca <generate_coredump+0xda>
mov    -0x10(%rbp),%rsi
mov    -0x2003c(%rbp),%edx
mov    -0x20040(%rbp),%ecx
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1110 <fatal@plt>
mov    -0x14(%rbp),%edi
mov    $0x1a0,%esi
call   10d0 <fchmod@plt>
cmp    $0xffffffff,%eax
jne    12f3 <generate_coredump+0x103>
lea    0xd76(%rip),%rdi
mov    $0x1a0,%esi
mov    $0x0,%al
call   1110 <fatal@plt>
jmp    12f8 <generate_coredump+0x108>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
lea    -0x10020(%rbp),%rsi
mov    $0x10000,%edx
call   10a0 <read@plt>
mov    %rax,-0x20028(%rbp)
cmp    $0x0,%rax
jle    147d <generate_coredump+0x28d>
lea    -0x10020(%rbp),%rdi
lea    -0x20020(%rbp),%rsi
mov    -0x20028(%rbp),%rdx
call   10b0 <memcmp@plt>
cmp    $0x0,%rax
jne    1400 <generate_coredump+0x210>
mov    -0x14(%rbp),%edi
mov    0x2c87(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <lseek@plt>
mov    %rax,-0x20038(%rbp)
cmpq   $0xffffffffffffffff,-0x20038(%rbp)
ff
jne    1386 <generate_coredump+0x196>
mov    -0x10(%rbp),%rsi
lea    0xcf1(%rip),%rdi
mov    $0x0,%al
call   1030 <warning@plt>
jmp    147d <generate_coredump+0x28d>
mov    -0x14(%rbp),%edi
mov    -0x20038(%rbp),%rsi
add    -0x20028(%rbp),%rsi
call   1050 <ftruncate@plt>
cmp    $0xffffffff,%eax
jne    13bc <generate_coredump+0x1cc>
mov    -0x10(%rbp),%rsi
lea    0xcc5(%rip),%rdi
mov    $0x0,%al
call   1030 <warning@plt>
jmp    147d <generate_coredump+0x28d>
mov    -0x14(%rbp),%edi
mov    0x2c12(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <lseek@plt>
mov    %rax,-0x20038(%rbp)
cmpq   $0xffffffffffffffff,-0x20038(%rbp)
ff
jne    13fb <generate_coredump+0x20b>
mov    -0x10(%rbp),%rsi
lea    0xc7c(%rip),%rdi
mov    $0x0,%al
call   1030 <warning@plt>
jmp    147d <generate_coredump+0x28d>
jmp    12f8 <generate_coredump+0x108>
mov    -0x14(%rbp),%edi
lea    -0x10020(%rbp),%rsi
mov    -0x20028(%rbp),%rdx
call   1040 <write@plt>
mov    %rax,-0x20030(%rbp)
cmpq   $0x0,-0x20030(%rbp)
jge    143e <generate_coredump+0x24e>
lea    0xc51(%rip),%rdi
mov    $0x0,%al
call   1030 <warning@plt>
jmp    147d <generate_coredump+0x28d>
mov    -0x20030(%rbp),%rax
cmp    -0x20028(%rbp),%rax
je     1473 <generate_coredump+0x283>
mov    -0x20030(%rbp),%rsi
mov    -0x20028(%rbp),%rdx
lea    0xc3a(%rip),%rdi
mov    $0x0,%al
call   1030 <warning@plt>
jmp    147d <generate_coredump+0x28d>
jmp    1478 <generate_coredump+0x288>
jmp    12f8 <generate_coredump+0x108>
cmpq   $0x0,-0x20028(%rbp)
jge    1499 <generate_coredump+0x2a9>
lea    0xc44(%rip),%rdi
mov    $0x0,%al
call   1030 <warning@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
add    $0x20040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_coredump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20018,%rsp
mov    %rdi,%rbx
lea    0x10(%rsp),%rdi
mov    $0x10000,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    0xde4(%rip),%rdi
mov    %rbx,%rsi
call   10c0 <format@plt>
mov    0x2dcd(%rip),%rcx
mov    0x2dbe(%rip),%rdx
mov    (%rdx),%esi
or     (%rcx),%esi
mov    %rax,%r14
mov    0x2d78(%rip),%rax
or     (%rax),%esi
mov    %r14,%rdi
xor    %edx,%edx
call   10e0 <open@plt>
cmp    $0xffffffff,%eax
je     13a6 <generate_coredump+0x1b6>
mov    %eax,%r12d
xor    %eax,%eax
call   1080 <geteuid@plt>
mov    %eax,%ebx
lea    0xdd2(%rip),%rdi
call   1100 <to_gid@plt>
mov    %eax,%ebp
mov    %r12d,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   10f0 <fchown@plt>
cmp    $0xffffffff,%eax
jne    1295 <generate_coredump+0xa5>
lea    0xdc4(%rip),%rdi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1110 <fatal@plt>
mov    %r12d,%edi
mov    $0x1a0,%esi
call   10d0 <fchmod@plt>
cmp    $0xffffffff,%eax
jne    12ba <generate_coredump+0xca>
lea    0xdaf(%rip),%rdi
mov    $0x1a0,%esi
xor    %eax,%eax
call   1110 <fatal@plt>
mov    0x2d07(%rip),%r13
mov    0x0(%r13),%edi
lea    0x10010(%rsp),%rsi
mov    $0x10000,%edx
call   10a0 <read@plt>
mov    %rax,%rbp
test   %rax,%rax
jle    13c8 <generate_coredump+0x1d8>
mov    %r14,0x8(%rsp)
lea    0x10010(%rsp),%rbx
lea    0x10(%rsp),%r15
mov    0x2cdc(%rip),%r14
jmp    131d <generate_coredump+0x12d>
xchg   %ax,%ax
mov    0x0(%r13),%edi
mov    %rbx,%rsi
mov    $0x10000,%edx
call   10a0 <read@plt>
mov    %rax,%rbp
test   %rax,%rax
jle    13c8 <generate_coredump+0x1d8>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   10b0 <memcmp@plt>
test   %rax,%rax
je     1360 <generate_coredump+0x170>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1040 <write@plt>
test   %rax,%rax
js     13d6 <generate_coredump+0x1e6>
cmp    %rbp,%rax
je     1300 <generate_coredump+0x110>
jmp    13e6 <generate_coredump+0x1f6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edx
mov    %r12d,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
je     139d <generate_coredump+0x1ad>
add    %rbp,%rax
mov    %r12d,%edi
mov    %rax,%rsi
call   1050 <ftruncate@plt>
cmp    $0xffffffff,%eax
je     13fc <generate_coredump+0x20c>
mov    (%r14),%edx
mov    %r12d,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
cmp    $0xffffffffffffffff,%rax
jne    1300 <generate_coredump+0x110>
lea    0xcc7(%rip),%rdi
jmp    1403 <generate_coredump+0x213>
lea    0xc6f(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x20018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <warning@plt>
test   %rbp,%rbp
jns    140f <generate_coredump+0x21f>
lea    0xd02(%rip),%rdi
jmp    13dd <generate_coredump+0x1ed>
lea    0xca6(%rip),%rdi
xor    %eax,%eax
call   1030 <warning@plt>
jmp    140f <generate_coredump+0x21f>
lea    0xcb4(%rip),%rdi
mov    %rax,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1030 <warning@plt>
jmp    140f <generate_coredump+0x21f>
lea    0xc72(%rip),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1030 <warning@plt>
mov    %r12d,%edi
call   1090 <close@plt>
add    $0x20018,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"/var/crash_reports/core__%s\00"
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@O_WRONLY = global i32 0
@.str.1 = [30 x i8] c"%s: cannot open coredump file\00"
@.str.2 = [17 x i8] c"gr_crash_reports\00"
@.str.3 = [18 x i8] c"%s: fchown %d:%d\0A\00"
@.str.4 = [14 x i8] c"%s: fchmod %o\00"
@STDIN_FILENO = global i32 0
@SEEK_END = global i32 0
@.str.5 = [10 x i8] c"%s: lseek\00"
@.str.6 = [14 x i8] c"%s: ftruncate\00"
@.str.7 = [30 x i8] c"failed to write coredump data\00"
@.str.8 = [53 x i8] c"failed to write coredump data: short write, %d of %d\00"
@.str.9 = [39 x i8] c"failed to read coredump data from pipe\00"
define void @generate_coredump(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [65536 x i8]
%6 = alloca [65536 x i8]
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %2
%12 = bitcast [65536 x i8]* %6 to i8*
%13 = load i8*, i8** %2
%14 = call i8* @format(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %13)
store i8* %14, i8** %3
%15 = load i8*, i8** %3
%16 = load i32, i32* @O_CREAT
%17 = load i32, i32* @O_TRUNC
%18 = or i32 %16, %17
%19 = load i32, i32* @O_WRONLY
%20 = or i32 %18, %19
%21 = call i32 @open(i8* %15, i32 %20, i32 0)
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %27
24: ; preds = %1
%25 = load i8*, i8** %3
%26 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %114
27: ; preds = %1
%28 = call i32 (...) @geteuid()
store i32 %28, i32* %10
%29 = call i32 @to_gid(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 %29, i32* %11
%30 = load i32, i32* %4
%31 = load i32, i32* %10
%32 = load i32, i32* %11
%33 = call i32 @fchown(i32 %30, i32 %31, i32 %32)
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %40
35: ; preds = %27
%36 = load i8*, i8** %3
%37 = load i32, i32* %10
%38 = load i32, i32* %11
%39 = call i32 (i8*, ...) @fatal(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %36, i32 %37, i32 %38)
br label %40
40: ; preds = %35, %27
%41 = load i32, i32* %4
%42 = call i32 @fchmod(i32 %41, i32 416)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = call i32 (i8*, ...) @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 416)
br label %46
46: ; preds = %44, %40
br label %47
47: ; preds = %105, %86, %46
%48 = load i32, i32* @STDIN_FILENO
%49 = getelementptr inbounds [65536 x i8], [65536 x i8]* %5, i64 0, i64 0
%50 = call i64 @read(i32 %48, i8* %49, i32 65536)
store i64 %50, i64* %7
%51 = icmp sgt i64 %50, 0
br i1 %51, label %52, label %106
52: ; preds = %47
%53 = getelementptr inbounds [65536 x i8], [65536 x i8]* %5, i64 0, i64 0
%54 = getelementptr inbounds [65536 x i8], [65536 x i8]* %6, i64 0, i64 0
%55 = load i64, i64* %7
%56 = call i64 @memcmp(i8* %53, i8* %54, i64 %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %87
58: ; preds = %52
%59 = load i32, i32* %4
%60 = load i32, i32* @SEEK_END
%61 = call i64 @lseek(i32 %59, i32 0, i32 %60)
store i64 %61, i64* %9
%62 = load i64, i64* %9
%63 = icmp eq i64 %62, -1
br i1 %63, label %64, label %67
64: ; preds = %58
%65 = load i8*, i8** %3
%66 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %65)
br label %106
67: ; preds = %58
%68 = load i32, i32* %4
%69 = load i64, i64* %9
%70 = load i64, i64* %7
%71 = add nsw i64 %69, %70
%72 = call i32 @ftruncate(i32 %68, i64 %71)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %77
74: ; preds = %67
%75 = load i8*, i8** %3
%76 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %75)
br label %106
77: ; preds = %67
%78 = load i32, i32* %4
%79 = load i32, i32* @SEEK_END
%80 = call i64 @lseek(i32 %78, i32 0, i32 %79)
store i64 %80, i64* %9
%81 = load i64, i64* %9
%82 = icmp eq i64 %81, -1
br i1 %82, label %83, label %86
83: ; preds = %77
%84 = load i8*, i8** %3
%85 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %84)
br label %106
86: ; preds = %77
br label %47
87: ; preds = %52
%88 = load i32, i32* %4
%89 = getelementptr inbounds [65536 x i8], [65536 x i8]* %5, i64 0, i64 0
%90 = load i64, i64* %7
%91 = call i64 @write(i32 %88, i8* %89, i64 %90)
store i64 %91, i64* %8
%92 = load i64, i64* %8
%93 = icmp slt i64 %92, 0
br i1 %93, label %94, label %96
94: ; preds = %87
%95 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
br label %106
96: ; preds = %87
%97 = load i64, i64* %8
%98 = load i64, i64* %7
%99 = icmp ne i64 %97, %98
br i1 %99, label %100, label %104
100: ; preds = %96
%101 = load i64, i64* %8
%102 = load i64, i64* %7
%103 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.8, i64 0, i64 0), i64 %101, i64 %102)
br label %106
104: ; preds = %96
br label %105
105: ; preds = %104
br label %47
106: ; preds = %100, %94, %83, %74, %64, %47
%107 = load i64, i64* %7
%108 = icmp slt i64 %107, 0
br i1 %108, label %109, label %111
109: ; preds = %106
%110 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
br label %111
111: ; preds = %109, %106
%112 = load i32, i32* %4
%113 = call i32 @close(i32 %112)
br label %114
114: ; preds = %111, %24
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"/var/crash_reports/core__%s\00"
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@O_WRONLY = global i32 0
@.str.1 = [30 x i8] c"%s: cannot open coredump file\00"
@.str.2 = [17 x i8] c"gr_crash_reports\00"
@.str.3 = [18 x i8] c"%s: fchown %d:%d\0A\00"
@.str.4 = [14 x i8] c"%s: fchmod %o\00"
@STDIN_FILENO = global i32 0
@SEEK_END = global i32 0
@.str.5 = [10 x i8] c"%s: lseek\00"
@.str.6 = [14 x i8] c"%s: ftruncate\00"
@.str.7 = [30 x i8] c"failed to write coredump data\00"
@.str.8 = [53 x i8] c"failed to write coredump data: short write, %d of %d\00"
@.str.9 = [39 x i8] c"failed to read coredump data from pipe\00"
define void @generate_coredump(i8* %0) {
%2 = alloca [65536 x i8]
%3 = alloca [65536 x i8]
%4 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 0
%6 = tail call i8* @format(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = load i32, i32* @O_CREAT
%8 = load i32, i32* @O_TRUNC
%9 = or i32 %8, %7
%10 = load i32, i32* @O_WRONLY
%11 = or i32 %9, %10
%12 = tail call i32 @open(i8* %6, i32 %11, i32 0)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = tail call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %74
16: ; preds = %1
%17 = tail call i32 (...) @geteuid()
%18 = tail call i32 @to_gid(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 @fchown(i32 %12, i32 %17, i32 %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = tail call i32 (i8*, ...) @fatal(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %6, i32 %17, i32 %18)
br label %23
23: ; preds = %21, %16
%24 = tail call i32 @fchmod(i32 %12, i32 416)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 (i8*, ...) @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 416)
br label %28
28: ; preds = %26, %23
%29 = load i32, i32* @STDIN_FILENO
%30 = call i64 @read(i32 %29, i8* %4, i32 65536)
%31 = icmp sgt i64 %30, 0
br i1 %31, label %32, label %67
32: ; preds = %28, %52
%33 = phi i64 [ %54, %52 ], [ %30, %28 ]
%34 = call i64 @memcmp(i8* %4, i8* %5, i64 %33)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %58
36: ; preds = %32
%37 = load i32, i32* @SEEK_END
%38 = call i64 @lseek(i32 %12, i32 0, i32 %37)
%39 = icmp eq i64 %38, -1
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %6)
br label %72
42: ; preds = %36
%43 = add nsw i64 %38, %33
%44 = call i32 @ftruncate(i32 %12, i64 %43)
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %6)
br label %72
48: ; preds = %42
%49 = load i32, i32* @SEEK_END
%50 = call i64 @lseek(i32 %12, i32 0, i32 %49)
%51 = icmp eq i64 %50, -1
br i1 %51, label %56, label %52
52: ; preds = %48, %63
%53 = load i32, i32* @STDIN_FILENO
%54 = call i64 @read(i32 %53, i8* %4, i32 65536)
%55 = icmp sgt i64 %54, 0
br i1 %55, label %32, label %67
56: ; preds = %48
%57 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %6)
br label %72
58: ; preds = %32
%59 = call i64 @write(i32 %12, i8* %4, i64 %33)
%60 = icmp slt i64 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
br label %72
63: ; preds = %58
%64 = icmp eq i64 %59, %33
br i1 %64, label %52, label %65
65: ; preds = %63
%66 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.8, i64 0, i64 0), i64 %59, i64 %33)
br label %72
67: ; preds = %52, %28
%68 = phi i64 [ %30, %28 ], [ %54, %52 ]
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %67
%71 = call i32 (i8*, ...) @warning(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
br label %72
72: ; preds = %40, %46, %56, %61, %65, %70, %67
%73 = call i32 @close(i32 %12)
br label %74
74: ; preds = %72, %14
ret void
}