#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 */
struct stat {
  int /*<<< orphan*/ st_rdev;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
char MAJOR(int /*<<< orphan*/);
char MINOR(int /*<<< orphan*/);
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ die(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, ...);
int open(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int read(int, char *, int);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int write(int, char *, int);
int main(int argc, char **argv) {
  int i, c, id;
  char buf[1024];
  char major_root, minor_root;
  char major_swap, minor_swap;
  struct stat sb;
  if ((argc < 4) || (argc > 6))
    usage();
  if (argc > 4) {
    if (strcmp(argv[4], "FLOPPY")) {
      if (stat(argv[4], &sb)) {
        perror(argv[4]);
        die("Couldn't stat root device.");
      }
      major_root = MAJOR(sb.st_rdev);
      minor_root = MINOR(sb.st_rdev);
    } else {
      major_root = 0;
      minor_root = 0;
    }
  } else {
    major_root = 3;
    minor_root = 6;
  }
  if (argc == 6) {
    if (strcmp(argv[5], "NONE")) {
      if (stat(argv[5], &sb)) {
        perror(argv[5]);
        die("Couldn't stat root device.");
      }
      major_swap = MAJOR(sb.st_rdev);
      minor_swap = MINOR(sb.st_rdev);
    } else {
      major_swap = 0;
      minor_swap = 0;
    }
  } else {
    major_swap = 0;
    minor_swap = 0;
  }
  fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
  fprintf(stderr, "Swap device is (%d, %d)\n", major_swap, minor_swap);
  if ((major_root != 2) && (major_root != 3) && (major_root != 0)) {
    fprintf(stderr, "Illegal root device (major = %d)\n", major_root);
    die("Bad root device --- major #");
  }
  if (major_swap && major_swap != 3) {
    fprintf(stderr, "Illegal swap device (major = %d)\n", major_swap);
    die("Bad root device --- major #");
  }
  for (i = 0; i < sizeof buf; i++)
    buf[i] = 0;
  if ((id = open(argv[1], O_RDONLY, 0)) < 0)
    die("Unable to open 'boot'");
  if (read(id, buf, 32) != 32)
    die("Unable to read header of 'boot'");
  if (((long *)buf)[0] != 0x04100301)
    die("Non-Minix header of 'boot'");
  if (((long *)buf)[1] != 32)
    die("Non-Minix header of 'boot'");
  if (((long *)buf)[3] != 0)
    die("Illegal data segment in 'boot'");
  if (((long *)buf)[4] != 0)
    die("Illegal bss in 'boot'");
  if (((long *)buf)[5] != 0)
    die("Non-Minix header of 'boot'");
  if (((long *)buf)[7] != 0)
    die("Illegal symbol table in 'boot'");
  i = read(id, buf, sizeof buf);
  fprintf(stderr, "Boot sector %d bytes.\n", i);
  if (i != 512)
    die("Boot block must be exactly 512 bytes");
  if ((*(unsigned short *)(buf + 510)) != 0xAA55)
    die("Boot block hasn't got boot flag (0xAA55)");
  buf[506] = (char)minor_swap;
  buf[507] = (char)major_swap;
  buf[508] = (char)minor_root;
  buf[509] = (char)major_root;
  i = write(1, buf, 512);
  if (i != 512)
    die("Write call failed");
  close(id);
  if ((id = open(argv[2], O_RDONLY, 0)) < 0)
    die("Unable to open 'setup'");
  if (read(id, buf, 32) != 32)
    die("Unable to read header of 'setup'");
  if (((long *)buf)[0] != 0x04100301)
    die("Non-Minix header of 'setup'");
  if (((long *)buf)[1] != 32)
    die("Non-Minix header of 'setup'");
  if (((long *)buf)[3] != 0)
    die("Illegal data segment in 'setup'");
  if (((long *)buf)[4] != 0)
    die("Illegal bss in 'setup'");
  if (((long *)buf)[5] != 0)
    die("Non-Minix header of 'setup'");
  if (((long *)buf)[7] != 0)
    die("Illegal symbol table in 'setup'");
  for (i = 0; (c = read(id, buf, sizeof buf)) > 0; i += c)
    if (write(1, buf, c) != c)
      die("Write call failed");
  close(id);
  if (i > 4 * 512)
    die("Setup exceeds "
        "SETUP_SECTS"
        " sectors - rewrite build/boot/setup");
  fprintf(stderr, "Setup is %d bytes.\n", i);
  for (c = 0; c < sizeof(buf); c++)
    buf[c] = '\0';
  while (i < 4 * 512) {
    c = 4 * 512 - i;
    if (c > sizeof(buf))
      c = sizeof(buf);
    if (write(1, buf, c) != c)
      die("Write call failed");
    i += c;
  }
  if ((id = open(argv[3], O_RDONLY, 0)) < 0)
    die("Unable to open 'system'");
  if (read(id, buf, 1024) != 1024)
    die("Unable to read header of 'system'");
  if (((long *)buf)[5] != 0)
    die("Non-GCC header of 'system'");
  for (i = 0; (c = read(id, buf, sizeof buf)) > 0; i += c)
    if (write(1, buf, c) != c)
      die("Write call failed");
  close(id);
  fprintf(stderr, "System is %d bytes.\n", i);
  if (i > 0x3000 * 16)
    die("System is too big");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jl     11ed <main+0x2d>
cmpl   $0x6,-0x8(%rbp)
jle    11f4 <main+0x34>
mov    $0x0,%al
call   10b0 <usage@plt>
cmpl   $0x4,-0x8(%rbp)
jle    128d <main+0xcd>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xdf3(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     127a <main+0xba>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    -0x428(%rbp),%rsi
call   10a0 <stat@plt>
cmp    $0x0,%rax
je     1253 <main+0x93>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10e0 <perror@plt>
lea    0xdb9(%rip),%rdi
call   10d0 <die@plt>
mov    -0x428(%rbp),%edi
call   1040 <MAJOR@plt>
mov    %al,-0x421(%rbp)
mov    -0x428(%rbp),%edi
call   1080 <MINOR@plt>
mov    %al,-0x422(%rbp)
jmp    1288 <main+0xc8>
movb   $0x0,-0x421(%rbp)
movb   $0x0,-0x422(%rbp)
jmp    129b <main+0xdb>
movb   $0x3,-0x421(%rbp)
movb   $0x6,-0x422(%rbp)
cmpl   $0x6,-0x8(%rbp)
jne    1334 <main+0x174>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xd6e(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     1321 <main+0x161>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    -0x428(%rbp),%rsi
call   10a0 <stat@plt>
cmp    $0x0,%rax
je     12fa <main+0x13a>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   10e0 <perror@plt>
lea    0xd12(%rip),%rdi
call   10d0 <die@plt>
mov    -0x428(%rbp),%edi
call   1040 <MAJOR@plt>
mov    %al,-0x423(%rbp)
mov    -0x428(%rbp),%edi
call   1080 <MINOR@plt>
mov    %al,-0x424(%rbp)
jmp    132f <main+0x16f>
movb   $0x0,-0x423(%rbp)
movb   $0x0,-0x424(%rbp)
jmp    1342 <main+0x182>
movb   $0x0,-0x423(%rbp)
movb   $0x0,-0x424(%rbp)
mov    0x2c8f(%rip),%rax
mov    (%rax),%edi
movsbl -0x421(%rbp),%edx
movsbl -0x422(%rbp),%ecx
lea    0xcc7(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
movsbl -0x423(%rbp),%edx
movsbl -0x424(%rbp),%ecx
lea    0xcbb(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movsbl -0x421(%rbp),%eax
cmp    $0x2,%eax
je     13e6 <main+0x226>
movsbl -0x421(%rbp),%eax
cmp    $0x3,%eax
je     13e6 <main+0x226>
movsbl -0x421(%rbp),%eax
cmp    $0x0,%eax
je     13e6 <main+0x226>
mov    0x2c15(%rip),%rax
mov    (%rax),%edi
movsbl -0x421(%rbp),%edx
lea    0xc86(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
lea    0xc9a(%rip),%rdi
call   10d0 <die@plt>
movsbl -0x423(%rbp),%eax
cmp    $0x0,%eax
je     1430 <main+0x270>
movsbl -0x423(%rbp),%eax
cmp    $0x3,%eax
je     1430 <main+0x270>
mov    0x2bcb(%rip),%rax
mov    (%rax),%edi
movsbl -0x423(%rbp),%edx
lea    0xc7a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
lea    0xc50(%rip),%rdi
call   10d0 <die@plt>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x400,%rax
jae    1461 <main+0x2a1>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x420(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1437 <main+0x277>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2b78(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jge    1491 <main+0x2d1>
lea    0xc2d(%rip),%rdi
call   10d0 <die@plt>
mov    -0x1c(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x20,%edx
call   1060 <read@plt>
cmp    $0x20,%eax
je     14ba <main+0x2fa>
lea    0xc1a(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x4100301,-0x420(%rbp)
01 03 10 04
je     14d7 <main+0x317>
lea    0xc1d(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x20,-0x418(%rbp)
20
je     14f1 <main+0x331>
lea    0xc03(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x0,-0x408(%rbp)
je     150b <main+0x34b>
lea    0xc04(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x0,-0x400(%rbp)
je     1525 <main+0x365>
lea    0xc09(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x0,-0x3f8(%rbp)
je     153f <main+0x37f>
lea    0xbb5(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x0,-0x3e8(%rbp)
je     1559 <main+0x399>
lea    0xbeb(%rip),%rdi
call   10d0 <die@plt>
mov    -0x1c(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %eax,-0x14(%rbp)
mov    0x2a61(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xbdb(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
cmpl   $0x200,-0x14(%rbp)
je     15a3 <main+0x3e3>
lea    0xbd7(%rip),%rdi
call   10d0 <die@plt>
movzwl -0x222(%rbp),%eax
cmp    $0xaa55,%eax
je     15c1 <main+0x401>
lea    0xbde(%rip),%rdi
call   10d0 <die@plt>
mov    -0x424(%rbp),%al
mov    %al,-0x226(%rbp)
mov    -0x423(%rbp),%al
mov    %al,-0x225(%rbp)
mov    -0x422(%rbp),%al
mov    %al,-0x224(%rbp)
mov    -0x421(%rbp),%al
mov    %al,-0x223(%rbp)
lea    -0x420(%rbp),%rsi
mov    $0x1,%edi
mov    $0x200,%edx
call   1030 <write@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x200,-0x14(%rbp)
je     1623 <main+0x463>
lea    0xba5(%rip),%rdi
call   10d0 <die@plt>
mov    -0x1c(%rbp),%edi
call   1050 <close@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x29ae(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jge    165b <main+0x49b>
lea    0xb7f(%rip),%rdi
call   10d0 <die@plt>
mov    -0x1c(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x20,%edx
call   1060 <read@plt>
cmp    $0x20,%eax
je     1684 <main+0x4c4>
lea    0xb6d(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x4100301,-0x420(%rbp)
01 03 10 04
je     16a1 <main+0x4e1>
lea    0xb71(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x20,-0x418(%rbp)
20
je     16bb <main+0x4fb>
lea    0xb57(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x0,-0x408(%rbp)
je     16d5 <main+0x515>
lea    0xb59(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x0,-0x400(%rbp)
je     16ef <main+0x52f>
lea    0xb5f(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x0,-0x3f8(%rbp)
je     1709 <main+0x549>
lea    0xb09(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x0,-0x3e8(%rbp)
je     1723 <main+0x563>
lea    0xb42(%rip),%rdi
call   10d0 <die@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jle    1786 <main+0x5c6>
lea    -0x420(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
cmp    -0x18(%rbp),%eax
je     1773 <main+0x5b3>
lea    0xa55(%rip),%rdi
call   10d0 <die@plt>
jmp    1778 <main+0x5b8>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    172a <main+0x56a>
mov    -0x1c(%rbp),%edi
call   1050 <close@plt>
cmpl   $0x800,-0x14(%rbp)
jle    17a7 <main+0x5e7>
lea    0xade(%rip),%rdi
call   10d0 <die@plt>
mov    0x282a(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xb03(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x400,%rax
jae    17f2 <main+0x632>
movslq -0x18(%rbp),%rax
movb   $0x0,-0x420(%rbp,%rax,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    17c8 <main+0x608>
jmp    17f7 <main+0x637>
cmpl   $0x800,-0x14(%rbp)
jge    185d <main+0x69d>
mov    $0x800,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x400,%rax
jbe    1826 <main+0x666>
movl   $0x400,-0x18(%rbp)
lea    -0x420(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
cmp    -0x18(%rbp),%eax
je     184f <main+0x68f>
lea    0x979(%rip),%rdi
call   10d0 <die@plt>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    17f7 <main+0x637>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    0x277c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jge    188d <main+0x6cd>
lea    0xa49(%rip),%rdi
call   10d0 <die@plt>
mov    -0x1c(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
cmp    $0x400,%eax
je     18b8 <main+0x6f8>
lea    0xa36(%rip),%rdi
call   10d0 <die@plt>
cmpq   $0x0,-0x3f8(%rbp)
je     18d2 <main+0x712>
lea    0xa3e(%rip),%rdi
call   10d0 <die@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jle    1935 <main+0x775>
lea    -0x420(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
cmp    -0x18(%rbp),%eax
je     1922 <main+0x762>
lea    0x8a6(%rip),%rdi
call   10d0 <die@plt>
jmp    1927 <main+0x767>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    18d9 <main+0x719>
mov    -0x1c(%rbp),%edi
call   1050 <close@plt>
mov    0x2694(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0x9d6(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
cmpl   $0x30000,-0x14(%rbp)
jle    1970 <main+0x7b0>
lea    0x9d0(%rip),%rdi
call   10d0 <die@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
lea    -0x7(%rbx),%eax
cmp    $0xfffffffc,%eax
ja     11f5 <main+0x25>
xor    %eax,%eax
call   10c0 <usage@plt>
cmp    $0x5,%ebx
mov    %rbp,0x8(%rsp)
jl     1243 <main+0x73>
mov    0x20(%rbp),%rdi
lea    0xdf6(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1250 <main+0x80>
mov    0x20(%rbp),%rdi
mov    %rsp,%rsi
call   10b0 <stat@plt>
test   %rax,%rax
jne    1830 <main+0x660>
mov    (%rsp),%edi
call   1050 <MAJOR@plt>
mov    %eax,%r12d
mov    (%rsp),%edi
call   1090 <MINOR@plt>
cmp    $0x6,%ebx
jne    1248 <main+0x78>
jmp    125a <main+0x8a>
mov    $0x3,%r12b
mov    $0x6,%al
xor    %r15d,%r15d
xor    %r13d,%r13d
jmp    12a6 <main+0xd6>
xor    %r12d,%r12d
xor    %eax,%eax
cmp    $0x6,%ebx
jne    1248 <main+0x78>
mov    %eax,%ebx
mov    0x28(%rbp),%rdi
lea    0xdbb(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
je     129e <main+0xce>
mov    0x28(%rbp),%rdi
mov    %rsp,%rsi
call   10b0 <stat@plt>
test   %rax,%rax
jne    184a <main+0x67a>
mov    (%rsp),%edi
call   1050 <MAJOR@plt>
mov    %eax,%r15d
mov    (%rsp),%edi
call   1090 <MINOR@plt>
mov    %eax,%r13d
jmp    12a4 <main+0xd4>
xor    %r15d,%r15d
xor    %r13d,%r13d
mov    %ebx,%eax
mov    0x2d2b(%rip),%rbx
mov    (%rbx),%edi
movsbl %r12b,%r14d
mov    %eax,0x4(%rsp)
movsbl %al,%ecx
lea    0xd66(%rip),%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
movsbl %r15b,%ebp
movsbl %r13b,%ecx
lea    0xd64(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
cmp    $0x3,%r14b
ja     12f8 <main+0x128>
cmp    $0x1,%r12b
je     12f8 <main+0x128>
test   %r15b,%r15b
jne    1323 <main+0x153>
jmp    134e <main+0x17e>
mov    0x2cd9(%rip),%rax
mov    (%rax),%edi
lea    0xd51(%rip),%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0xd62(%rip),%rdi
call   10e0 <die@plt>
test   %r15b,%r15b
je     134e <main+0x17e>
cmp    $0x3,%r15b
je     134e <main+0x17e>
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
lea    0xd5e(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0xd32(%rip),%rdi
call   10e0 <die@plt>
lea    0x10(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    0x8(%rsp),%r14
mov    0x8(%r14),%rdi
mov    0x2c79(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <open@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    138a <main+0x1ba>
lea    0xd34(%rip),%rdi
call   10e0 <die@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x20,%edx
call   1070 <read@plt>
cmp    $0x20,%eax
jne    15fa <main+0x42a>
cmpq   $0x4100301,0x10(%rsp)
10 04
jne    1615 <main+0x445>
cmpq   $0x20,0x18(%rsp)
jne    162d <main+0x45d>
cmpq   $0x0,0x28(%rsp)
je     13d3 <main+0x203>
lea    0xd3c(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x0,0x30(%rsp)
je     13e7 <main+0x217>
lea    0xd47(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x0,0x38(%rsp)
je     13fb <main+0x22b>
lea    0xcf9(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x0,0x48(%rsp)
je     140f <main+0x23f>
lea    0xd35(%rip),%rdi
call   10e0 <die@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x400,%edx
call   1070 <read@plt>
mov    %eax,%ebx
mov    0x2baf(%rip),%rax
mov    (%rax),%edi
lea    0xd2c(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
cmp    $0x200,%ebx
je     144f <main+0x27f>
lea    0xd2b(%rip),%rdi
call   10e0 <die@plt>
movzwl 0x20e(%rsp),%eax
cmp    $0xaa55,%eax
je     146a <main+0x29a>
lea    0xd35(%rip),%rdi
call   10e0 <die@plt>
mov    %r13b,0x20a(%rsp)
mov    %r15b,0x20b(%rsp)
mov    0x4(%rsp),%eax
mov    %al,0x20c(%rsp)
mov    %r12b,0x20d(%rsp)
lea    0x10(%rsp),%rsi
mov    $0x1,%edi
mov    $0x200,%edx
call   1030 <write@plt>
cmp    $0x200,%eax
je     14b4 <main+0x2e4>
lea    0xd14(%rip),%rdi
call   10e0 <die@plt>
mov    %ebp,%edi
call   1060 <close@plt>
mov    0x10(%r14),%rdi
mov    0x2b22(%rip),%r13
mov    0x0(%r13),%esi
xor    %edx,%edx
call   10d0 <open@plt>
mov    %eax,%r15d
test   %eax,%eax
jns    14e4 <main+0x314>
lea    0xcf6(%rip),%rdi
call   10e0 <die@plt>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x20,%edx
call   1070 <read@plt>
cmp    $0x20,%eax
jne    164a <main+0x47a>
cmpq   $0x4100301,0x10(%rsp)
10 04
jne    1665 <main+0x495>
cmpq   $0x20,0x18(%rsp)
jne    167d <main+0x4ad>
cmpq   $0x0,0x28(%rsp)
je     152e <main+0x35e>
lea    0xd00(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x0,0x30(%rsp)
je     1542 <main+0x372>
lea    0xd0c(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x0,0x38(%rsp)
je     1556 <main+0x386>
lea    0xcbc(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x0,0x48(%rsp)
je     156a <main+0x39a>
lea    0xcfb(%rip),%rdi
call   10e0 <die@plt>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x400,%edx
call   1070 <read@plt>
test   %eax,%eax
jle    169a <main+0x4ca>
mov    %eax,%ebx
xor    %ebp,%ebp
lea    0x10(%rsp),%r12
lea    0xc2f(%rip),%r14
jmp    15b8 <main+0x3e8>
cs nopw 0x0(%rax,%rax,1)
add    %ebx,%ebp
mov    %r15d,%edi
mov    %r12,%rsi
mov    $0x400,%edx
call   1070 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    15d5 <main+0x405>
mov    $0x1,%edi
mov    %r12,%rsi
mov    %ebx,%edx
call   1030 <write@plt>
cmp    %ebx,%eax
je     15a0 <main+0x3d0>
mov    %r14,%rdi
call   10e0 <die@plt>
jmp    15a0 <main+0x3d0>
mov    %r15d,%edi
call   1060 <close@plt>
cmp    $0x801,%ebp
jl     16a4 <main+0x4d4>
lea    0xc90(%rip),%rdi
call   10e0 <die@plt>
jmp    16a4 <main+0x4d4>
lea    0xace(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x4100301,0x10(%rsp)
10 04
je     13b3 <main+0x1e3>
lea    0xad3(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x20,0x18(%rsp)
je     13bf <main+0x1ef>
lea    0xabb(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x0,0x28(%rsp)
jne    13c7 <main+0x1f7>
jmp    13d3 <main+0x203>
lea    0xb9b(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x4100301,0x10(%rsp)
10 04
je     150e <main+0x33e>
lea    0xba1(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x20,0x18(%rsp)
je     151a <main+0x34a>
lea    0xb89(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x0,0x28(%rsp)
jne    1522 <main+0x352>
jmp    152e <main+0x35e>
mov    %r15d,%edi
call   1060 <close@plt>
xor    %ebp,%ebp
mov    0x292d(%rip),%rax
mov    (%rax),%edi
lea    0xc09(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0x10(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1040 <memset@plt>
cmp    $0x7ff,%ebp
jg     1728 <main+0x558>
mov    $0x400,%r12d
lea    0x10(%rsp),%r15
lea    0xadb(%rip),%r14
jmp    16fa <main+0x52a>
nopw   0x0(%rax,%rax,1)
add    %ebx,%ebp
cmp    $0x800,%ebp
jge    1728 <main+0x558>
mov    $0x800,%ebx
sub    %ebp,%ebx
cmp    $0x400,%ebx
cmovae %r12d,%ebx
mov    $0x1,%edi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <write@plt>
cmp    %ebx,%eax
je     16f0 <main+0x520>
mov    %r14,%rdi
call   10e0 <die@plt>
jmp    16f0 <main+0x520>
mov    0x8(%rsp),%rax
mov    0x18(%rax),%rdi
mov    0x0(%r13),%esi
xor    %edx,%edx
call   10d0 <open@plt>
mov    %eax,%r14d
test   %eax,%eax
jns    174f <main+0x57f>
lea    0xb87(%rip),%rdi
call   10e0 <die@plt>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0x400,%edx
call   1070 <read@plt>
cmp    $0x400,%eax
je     1774 <main+0x5a4>
lea    0xb7a(%rip),%rdi
call   10e0 <die@plt>
cmpq   $0x0,0x38(%rsp)
je     1788 <main+0x5b8>
lea    0xb88(%rip),%rdi
call   10e0 <die@plt>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0x400,%edx
call   1070 <read@plt>
test   %eax,%eax
jle    17e5 <main+0x615>
mov    %eax,%ebx
xor    %ebp,%ebp
lea    0x10(%rsp),%r15
lea    0xa15(%rip),%r12
jmp    17c8 <main+0x5f8>
add    %ebx,%ebp
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0x400,%edx
call   1070 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    17e7 <main+0x617>
mov    $0x1,%edi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <write@plt>
cmp    %ebx,%eax
je     17b0 <main+0x5e0>
mov    %r12,%rdi
call   10e0 <die@plt>
jmp    17b0 <main+0x5e0>
xor    %ebp,%ebp
mov    %r14d,%edi
call   1060 <close@plt>
mov    0x27e2(%rip),%rax
mov    (%rax),%edi
lea    0xb27(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <fprintf@plt>
cmp    $0x30001,%ebp
jl     181c <main+0x64c>
lea    0xb24(%rip),%rdi
call   10e0 <die@plt>
xor    %eax,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x20(%rbp),%rdi
call   10f0 <perror@plt>
lea    0x7c7(%rip),%rdi
call   10e0 <die@plt>
jmp    1229 <main+0x59>
mov    0x28(%rbp),%rdi
call   10f0 <perror@plt>
lea    0x7ad(%rip),%rdi
call   10e0 <die@plt>
jmp    1286 <main+0xb6>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [7 x i8] c"FLOPPY\00"
@.str.1 = [27 x i8] c"Couldn't stat root device.\00"
@.str.2 = [5 x i8] c"NONE\00"
@stderr = global i32 0
@.str.3 = [25 x i8] c"Root device is (%d, %d)\0A\00"
@.str.4 = [25 x i8] c"Swap device is (%d, %d)\0A\00"
@.str.5 = [34 x i8] c"Illegal root device (major = %d)\0A\00"
@.str.6 = [28 x i8] c"Bad root device --- major #\00"
@.str.7 = [34 x i8] c"Illegal swap device (major = %d)\0A\00"
@O_RDONLY = global i32 0
@.str.8 = [22 x i8] c"Unable to open 'boot'\00"
@.str.9 = [32 x i8] c"Unable to read header of 'boot'\00"
@.str.10 = [27 x i8] c"Non-Minix header of 'boot'\00"
@.str.11 = [31 x i8] c"Illegal data segment in 'boot'\00"
@.str.12 = [22 x i8] c"Illegal bss in 'boot'\00"
@.str.13 = [31 x i8] c"Illegal symbol table in 'boot'\00"
@.str.14 = [23 x i8] c"Boot sector %d bytes.\0A\00"
@.str.15 = [37 x i8] c"Boot block must be exactly 512 bytes\00"
@.str.16 = [41 x i8] c"Boot block hasn't got boot flag (0xAA55)\00"
@.str.17 = [18 x i8] c"Write call failed\00"
@.str.18 = [23 x i8] c"Unable to open 'setup'\00"
@.str.19 = [33 x i8] c"Unable to read header of 'setup'\00"
@.str.20 = [28 x i8] c"Non-Minix header of 'setup'\00"
@.str.21 = [32 x i8] c"Illegal data segment in 'setup'\00"
@.str.22 = [23 x i8] c"Illegal bss in 'setup'\00"
@.str.23 = [32 x i8] c"Illegal symbol table in 'setup'\00"
@.str.24 = [61 x i8] c"Setup exceeds SETUP_SECTS sectors - rewrite build/boot/setup\00"
@.str.25 = [20 x i8] c"Setup is %d bytes.\0A\00"
@.str.26 = [24 x i8] c"Unable to open 'system'\00"
@.str.27 = [34 x i8] c"Unable to read header of 'system'\00"
@.str.28 = [27 x i8] c"Non-GCC header of 'system'\00"
@.str.29 = [21 x i8] c"System is %d bytes.\0A\00"
@.str.30 = [18 x i8] c"System is too big\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 [1024 x i8]
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
%14 = alloca %struct.stat
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 4
br i1 %16, label %20, label %17
17: ; preds = %2
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 6
br i1 %19, label %20, label %22
20: ; preds = %17, %2
%21 = call i32 (...) @usage()
br label %22
22: ; preds = %20, %17
%23 = load i32, i32* %4
%24 = icmp sgt i32 %23, 4
br i1 %24, label %25, label %52
25: ; preds = %22
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 4
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %50
31: ; preds = %25
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 4
%34 = load i8*, i8** %33
%35 = call i64 @stat(i8* %34, %struct.stat* %14)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %31
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 4
%40 = load i8*, i8** %39
%41 = call i32 @perror(i8* %40)
%42 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %37, %31
%44 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 0
%45 = load i32, i32* %44
%46 = call signext i8 @MAJOR(i32 %45)
store i8 %46, i8* %10
%47 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 0
%48 = load i32, i32* %47
%49 = call signext i8 @MINOR(i32 %48)
store i8 %49, i8* %11
br label %51
50: ; preds = %25
store i8 0, i8* %10
store i8 0, i8* %11
br label %51
51: ; preds = %50, %43
br label %53
52: ; preds = %22
store i8 3, i8* %10
store i8 6, i8* %11
br label %53
53: ; preds = %52, %51
%54 = load i32, i32* %4
%55 = icmp eq i32 %54, 6
br i1 %55, label %56, label %83
56: ; preds = %53
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 5
%59 = load i8*, i8** %58
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %81
62: ; preds = %56
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 5
%65 = load i8*, i8** %64
%66 = call i64 @stat(i8* %65, %struct.stat* %14)
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %74
68: ; preds = %62
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 5
%71 = load i8*, i8** %70
%72 = call i32 @perror(i8* %71)
%73 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %74
74: ; preds = %68, %62
%75 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 0
%76 = load i32, i32* %75
%77 = call signext i8 @MAJOR(i32 %76)
store i8 %77, i8* %12
%78 = getelementptr inbounds %struct.stat, %struct.stat* %14, i32 0, i32 0
%79 = load i32, i32* %78
%80 = call signext i8 @MINOR(i32 %79)
store i8 %80, i8* %13
br label %82
81: ; preds = %56
store i8 0, i8* %12
store i8 0, i8* %13
br label %82
82: ; preds = %81, %74
br label %84
83: ; preds = %53
store i8 0, i8* %12
store i8 0, i8* %13
br label %84
84: ; preds = %83, %82
%85 = load i32, i32* @stderr
%86 = load i8, i8* %10
%87 = sext i8 %86 to i32
%88 = load i8, i8* %11
%89 = sext i8 %88 to i32
%90 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %87, i32 %89)
%91 = load i32, i32* @stderr
%92 = load i8, i8* %12
%93 = sext i8 %92 to i32
%94 = load i8, i8* %13
%95 = sext i8 %94 to i32
%96 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %93, i32 %95)
%97 = load i8, i8* %10
%98 = sext i8 %97 to i32
%99 = icmp ne i32 %98, 2
br i1 %99, label %100, label %114
100: ; preds = %84
%101 = load i8, i8* %10
%102 = sext i8 %101 to i32
%103 = icmp ne i32 %102, 3
br i1 %103, label %104, label %114
104: ; preds = %100
%105 = load i8, i8* %10
%106 = sext i8 %105 to i32
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %114
108: ; preds = %104
%109 = load i32, i32* @stderr
%110 = load i8, i8* %10
%111 = sext i8 %110 to i32
%112 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i32 %111)
%113 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %114
114: ; preds = %108, %104, %100, %84
%115 = load i8, i8* %12
%116 = sext i8 %115 to i32
%117 = icmp ne i32 %116, 0
br i1 %117, label %118, label %128
118: ; preds = %114
%119 = load i8, i8* %12
%120 = sext i8 %119 to i32
%121 = icmp ne i32 %120, 3
br i1 %121, label %122, label %128
122: ; preds = %118
%123 = load i32, i32* @stderr
%124 = load i8, i8* %12
%125 = sext i8 %124 to i32
%126 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i32 %125)
%127 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %128
128: ; preds = %122, %118, %114
store i32 0, i32* %6
br label %129
129: ; preds = %137, %128
%130 = load i32, i32* %6
%131 = sext i32 %130 to i64
%132 = icmp ult i64 %131, 1024
br i1 %132, label %133, label %140
133: ; preds = %129
%134 = load i32, i32* %6
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %135
store i8 0, i8* %136
br label %137
137: ; preds = %133
%138 = load i32, i32* %6
%139 = add nsw i32 %138, 1
store i32 %139, i32* %6
br label %129
140: ; preds = %129
%141 = load i8**, i8*** %5
%142 = getelementptr inbounds i8*, i8** %141, i64 1
%143 = load i8*, i8** %142
%144 = load i32, i32* @O_RDONLY
%145 = call i32 @open(i8* %143, i32 %144, i32 0)
store i32 %145, i32* %8
%146 = icmp slt i32 %145, 0
br i1 %146, label %147, label %149
147: ; preds = %140
%148 = call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
br label %149
149: ; preds = %147, %140
%150 = load i32, i32* %8
%151 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%152 = call i32 @read(i32 %150, i8* %151, i32 32)
%153 = icmp ne i32 %152, 32
br i1 %153, label %154, label %156
154: ; preds = %149
%155 = call i32 @die(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
br label %156
156: ; preds = %154, %149
%157 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%158 = bitcast i8* %157 to i64*
%159 = getelementptr inbounds i64, i64* %158, i64 0
%160 = load i64, i64* %159
%161 = icmp ne i64 %160, 68158209
br i1 %161, label %162, label %164
162: ; preds = %156
%163 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
br label %164
164: ; preds = %162, %156
%165 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%166 = bitcast i8* %165 to i64*
%167 = getelementptr inbounds i64, i64* %166, i64 1
%168 = load i64, i64* %167
%169 = icmp ne i64 %168, 32
br i1 %169, label %170, label %172
170: ; preds = %164
%171 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
br label %172
172: ; preds = %170, %164
%173 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%174 = bitcast i8* %173 to i64*
%175 = getelementptr inbounds i64, i64* %174, i64 3
%176 = load i64, i64* %175
%177 = icmp ne i64 %176, 0
br i1 %177, label %178, label %180
178: ; preds = %172
%179 = call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
br label %180
180: ; preds = %178, %172
%181 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%182 = bitcast i8* %181 to i64*
%183 = getelementptr inbounds i64, i64* %182, i64 4
%184 = load i64, i64* %183
%185 = icmp ne i64 %184, 0
br i1 %185, label %186, label %188
186: ; preds = %180
%187 = call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
br label %188
188: ; preds = %186, %180
%189 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%190 = bitcast i8* %189 to i64*
%191 = getelementptr inbounds i64, i64* %190, i64 5
%192 = load i64, i64* %191
%193 = icmp ne i64 %192, 0
br i1 %193, label %194, label %196
194: ; preds = %188
%195 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
br label %196
196: ; preds = %194, %188
%197 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%198 = bitcast i8* %197 to i64*
%199 = getelementptr inbounds i64, i64* %198, i64 7
%200 = load i64, i64* %199
%201 = icmp ne i64 %200, 0
br i1 %201, label %202, label %204
202: ; preds = %196
%203 = call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0))
br label %204
204: ; preds = %202, %196
%205 = load i32, i32* %8
%206 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%207 = call i32 @read(i32 %205, i8* %206, i32 1024)
store i32 %207, i32* %6
%208 = load i32, i32* @stderr
%209 = load i32, i32* %6
%210 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %208, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %209)
%211 = load i32, i32* %6
%212 = icmp ne i32 %211, 512
br i1 %212, label %213, label %215
213: ; preds = %204
%214 = call i32 @die(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.15, i64 0, i64 0))
br label %215
215: ; preds = %213, %204
%216 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%217 = getelementptr inbounds i8, i8* %216, i64 510
%218 = bitcast i8* %217 to i16*
%219 = load i16, i16* %218
%220 = zext i16 %219 to i32
%221 = icmp ne i32 %220, 43605
br i1 %221, label %222, label %224
222: ; preds = %215
%223 = call i32 @die(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.16, i64 0, i64 0))
br label %224
224: ; preds = %222, %215
%225 = load i8, i8* %13
%226 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 506
store i8 %225, i8* %226
%227 = load i8, i8* %12
%228 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 507
store i8 %227, i8* %228
%229 = load i8, i8* %11
%230 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 508
store i8 %229, i8* %230
%231 = load i8, i8* %10
%232 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 509
store i8 %231, i8* %232
%233 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%234 = call i32 @write(i32 1, i8* %233, i32 512)
store i32 %234, i32* %6
%235 = load i32, i32* %6
%236 = icmp ne i32 %235, 512
br i1 %236, label %237, label %239
237: ; preds = %224
%238 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0))
br label %239
239: ; preds = %237, %224
%240 = load i32, i32* %8
%241 = call i32 @close(i32 %240)
%242 = load i8**, i8*** %5
%243 = getelementptr inbounds i8*, i8** %242, i64 2
%244 = load i8*, i8** %243
%245 = load i32, i32* @O_RDONLY
%246 = call i32 @open(i8* %244, i32 %245, i32 0)
store i32 %246, i32* %8
%247 = icmp slt i32 %246, 0
br i1 %247, label %248, label %250
248: ; preds = %239
%249 = call i32 @die(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0))
br label %250
250: ; preds = %248, %239
%251 = load i32, i32* %8
%252 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%253 = call i32 @read(i32 %251, i8* %252, i32 32)
%254 = icmp ne i32 %253, 32
br i1 %254, label %255, label %257
255: ; preds = %250
%256 = call i32 @die(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.19, i64 0, i64 0))
br label %257
257: ; preds = %255, %250
%258 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%259 = bitcast i8* %258 to i64*
%260 = getelementptr inbounds i64, i64* %259, i64 0
%261 = load i64, i64* %260
%262 = icmp ne i64 %261, 68158209
br i1 %262, label %263, label %265
263: ; preds = %257
%264 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
br label %265
265: ; preds = %263, %257
%266 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%267 = bitcast i8* %266 to i64*
%268 = getelementptr inbounds i64, i64* %267, i64 1
%269 = load i64, i64* %268
%270 = icmp ne i64 %269, 32
br i1 %270, label %271, label %273
271: ; preds = %265
%272 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
br label %273
273: ; preds = %271, %265
%274 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%275 = bitcast i8* %274 to i64*
%276 = getelementptr inbounds i64, i64* %275, i64 3
%277 = load i64, i64* %276
%278 = icmp ne i64 %277, 0
br i1 %278, label %279, label %281
279: ; preds = %273
%280 = call i32 @die(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.21, i64 0, i64 0))
br label %281
281: ; preds = %279, %273
%282 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%283 = bitcast i8* %282 to i64*
%284 = getelementptr inbounds i64, i64* %283, i64 4
%285 = load i64, i64* %284
%286 = icmp ne i64 %285, 0
br i1 %286, label %287, label %289
287: ; preds = %281
%288 = call i32 @die(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.22, i64 0, i64 0))
br label %289
289: ; preds = %287, %281
%290 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%291 = bitcast i8* %290 to i64*
%292 = getelementptr inbounds i64, i64* %291, i64 5
%293 = load i64, i64* %292
%294 = icmp ne i64 %293, 0
br i1 %294, label %295, label %297
295: ; preds = %289
%296 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
br label %297
297: ; preds = %295, %289
%298 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%299 = bitcast i8* %298 to i64*
%300 = getelementptr inbounds i64, i64* %299, i64 7
%301 = load i64, i64* %300
%302 = icmp ne i64 %301, 0
br i1 %302, label %303, label %305
303: ; preds = %297
%304 = call i32 @die(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.23, i64 0, i64 0))
br label %305
305: ; preds = %303, %297
store i32 0, i32* %6
br label %306
306: ; preds = %320, %305
%307 = load i32, i32* %8
%308 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%309 = call i32 @read(i32 %307, i8* %308, i32 1024)
store i32 %309, i32* %7
%310 = icmp sgt i32 %309, 0
br i1 %310, label %311, label %324
311: ; preds = %306
%312 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%313 = load i32, i32* %7
%314 = call i32 @write(i32 1, i8* %312, i32 %313)
%315 = load i32, i32* %7
%316 = icmp ne i32 %314, %315
br i1 %316, label %317, label %319
317: ; preds = %311
%318 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0))
br label %319
319: ; preds = %317, %311
br label %320
320: ; preds = %319
%321 = load i32, i32* %7
%322 = load i32, i32* %6
%323 = add nsw i32 %322, %321
store i32 %323, i32* %6
br label %306
324: ; preds = %306
%325 = load i32, i32* %8
%326 = call i32 @close(i32 %325)
%327 = load i32, i32* %6
%328 = icmp sgt i32 %327, 2048
br i1 %328, label %329, label %331
329: ; preds = %324
%330 = call i32 @die(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.24, i64 0, i64 0))
br label %331
331: ; preds = %329, %324
%332 = load i32, i32* @stderr
%333 = load i32, i32* %6
%334 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %332, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.25, i64 0, i64 0), i32 %333)
store i32 0, i32* %7
br label %335
335: ; preds = %343, %331
%336 = load i32, i32* %7
%337 = sext i32 %336 to i64
%338 = icmp ult i64 %337, 1024
br i1 %338, label %339, label %346
339: ; preds = %335
%340 = load i32, i32* %7
%341 = sext i32 %340 to i64
%342 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %341
store i8 0, i8* %342
br label %343
343: ; preds = %339
%344 = load i32, i32* %7
%345 = add nsw i32 %344, 1
store i32 %345, i32* %7
br label %335
346: ; preds = %335
br label %347
347: ; preds = %365, %346
%348 = load i32, i32* %6
%349 = icmp slt i32 %348, 2048
br i1 %349, label %350, label %369
350: ; preds = %347
%351 = load i32, i32* %6
%352 = sub nsw i32 2048, %351
store i32 %352, i32* %7
%353 = load i32, i32* %7
%354 = sext i32 %353 to i64
%355 = icmp ugt i64 %354, 1024
br i1 %355, label %356, label %357
356: ; preds = %350
store i32 1024, i32* %7
br label %357
357: ; preds = %356, %350
%358 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%359 = load i32, i32* %7
%360 = call i32 @write(i32 1, i8* %358, i32 %359)
%361 = load i32, i32* %7
%362 = icmp ne i32 %360, %361
br i1 %362, label %363, label %365
363: ; preds = %357
%364 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0))
br label %365
365: ; preds = %363, %357
%366 = load i32, i32* %7
%367 = load i32, i32* %6
%368 = add nsw i32 %367, %366
store i32 %368, i32* %6
br label %347
369: ; preds = %347
%370 = load i8**, i8*** %5
%371 = getelementptr inbounds i8*, i8** %370, i64 3
%372 = load i8*, i8** %371
%373 = load i32, i32* @O_RDONLY
%374 = call i32 @open(i8* %372, i32 %373, i32 0)
store i32 %374, i32* %8
%375 = icmp slt i32 %374, 0
br i1 %375, label %376, label %378
376: ; preds = %369
%377 = call i32 @die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.26, i64 0, i64 0))
br label %378
378: ; preds = %376, %369
%379 = load i32, i32* %8
%380 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%381 = call i32 @read(i32 %379, i8* %380, i32 1024)
%382 = icmp ne i32 %381, 1024
br i1 %382, label %383, label %385
383: ; preds = %378
%384 = call i32 @die(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.27, i64 0, i64 0))
br label %385
385: ; preds = %383, %378
%386 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%387 = bitcast i8* %386 to i64*
%388 = getelementptr inbounds i64, i64* %387, i64 5
%389 = load i64, i64* %388
%390 = icmp ne i64 %389, 0
br i1 %390, label %391, label %393
391: ; preds = %385
%392 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.28, i64 0, i64 0))
br label %393
393: ; preds = %391, %385
store i32 0, i32* %6
br label %394
394: ; preds = %408, %393
%395 = load i32, i32* %8
%396 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%397 = call i32 @read(i32 %395, i8* %396, i32 1024)
store i32 %397, i32* %7
%398 = icmp sgt i32 %397, 0
br i1 %398, label %399, label %412
399: ; preds = %394
%400 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%401 = load i32, i32* %7
%402 = call i32 @write(i32 1, i8* %400, i32 %401)
%403 = load i32, i32* %7
%404 = icmp ne i32 %402, %403
br i1 %404, label %405, label %407
405: ; preds = %399
%406 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0))
br label %407
407: ; preds = %405, %399
br label %408
408: ; preds = %407
%409 = load i32, i32* %7
%410 = load i32, i32* %6
%411 = add nsw i32 %410, %409
store i32 %411, i32* %6
br label %394
412: ; preds = %394
%413 = load i32, i32* %8
%414 = call i32 @close(i32 %413)
%415 = load i32, i32* @stderr
%416 = load i32, i32* %6
%417 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %415, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.29, i64 0, i64 0), i32 %416)
%418 = load i32, i32* %6
%419 = icmp sgt i32 %418, 196608
br i1 %419, label %420, label %422
420: ; preds = %412
%421 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.30, i64 0, i64 0))
br label %422
422: ; preds = %420, %412
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [7 x i8] c"FLOPPY\00"
@.str.1 = [27 x i8] c"Couldn't stat root device.\00"
@.str.2 = [5 x i8] c"NONE\00"
@stderr = global i32 0
@.str.3 = [25 x i8] c"Root device is (%d, %d)\0A\00"
@.str.4 = [25 x i8] c"Swap device is (%d, %d)\0A\00"
@.str.5 = [34 x i8] c"Illegal root device (major = %d)\0A\00"
@.str.6 = [28 x i8] c"Bad root device --- major #\00"
@.str.7 = [34 x i8] c"Illegal swap device (major = %d)\0A\00"
@O_RDONLY = global i32 0
@.str.8 = [22 x i8] c"Unable to open 'boot'\00"
@.str.9 = [32 x i8] c"Unable to read header of 'boot'\00"
@.str.10 = [27 x i8] c"Non-Minix header of 'boot'\00"
@.str.11 = [31 x i8] c"Illegal data segment in 'boot'\00"
@.str.12 = [22 x i8] c"Illegal bss in 'boot'\00"
@.str.13 = [31 x i8] c"Illegal symbol table in 'boot'\00"
@.str.14 = [23 x i8] c"Boot sector %d bytes.\0A\00"
@.str.15 = [37 x i8] c"Boot block must be exactly 512 bytes\00"
@.str.16 = [41 x i8] c"Boot block hasn't got boot flag (0xAA55)\00"
@.str.17 = [18 x i8] c"Write call failed\00"
@.str.18 = [23 x i8] c"Unable to open 'setup'\00"
@.str.19 = [33 x i8] c"Unable to read header of 'setup'\00"
@.str.20 = [28 x i8] c"Non-Minix header of 'setup'\00"
@.str.21 = [32 x i8] c"Illegal data segment in 'setup'\00"
@.str.22 = [23 x i8] c"Illegal bss in 'setup'\00"
@.str.23 = [32 x i8] c"Illegal symbol table in 'setup'\00"
@.str.24 = [61 x i8] c"Setup exceeds SETUP_SECTS sectors - rewrite build/boot/setup\00"
@.str.25 = [20 x i8] c"Setup is %d bytes.\0A\00"
@.str.26 = [24 x i8] c"Unable to open 'system'\00"
@.str.27 = [34 x i8] c"Unable to read header of 'system'\00"
@.str.28 = [27 x i8] c"Non-GCC header of 'system'\00"
@.str.29 = [21 x i8] c"System is %d bytes.\0A\00"
@.str.30 = [18 x i8] c"System is too big\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = alloca %struct.stat
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = bitcast %struct.stat* %5 to i8*
%8 = add i32 %0, -7
%9 = icmp ult i32 %8, -3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @usage()
br label %12
12: ; preds = %2, %10
%13 = icmp sgt i32 %0, 4
br i1 %13, label %14, label %56
14: ; preds = %12
%15 = getelementptr inbounds i8*, i8** %1, i64 4
%16 = load i8*, i8** %15
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %33, label %19
19: ; preds = %14
%20 = load i8*, i8** %15
%21 = call i64 @stat(i8* %20, %struct.stat* %5)
%22 = icmp eq i64 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = load i8*, i8** %15
%25 = call i32 @perror(i8* %24)
%26 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %23, %19
%28 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
%29 = load i32, i32* %28
%30 = call signext i8 @MAJOR(i32 %29)
%31 = load i32, i32* %28
%32 = call signext i8 @MINOR(i32 %31)
br label %33
33: ; preds = %14, %27
%34 = phi i8 [ %30, %27 ], [ 0, %14 ]
%35 = phi i8 [ %32, %27 ], [ 0, %14 ]
%36 = icmp eq i32 %0, 6
br i1 %36, label %37, label %56
37: ; preds = %33
%38 = getelementptr inbounds i8*, i8** %1, i64 5
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %56, label %42
42: ; preds = %37
%43 = load i8*, i8** %38
%44 = call i64 @stat(i8* %43, %struct.stat* %5)
%45 = icmp eq i64 %44, 0
br i1 %45, label %50, label %46
46: ; preds = %42
%47 = load i8*, i8** %38
%48 = call i32 @perror(i8* %47)
%49 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %50
50: ; preds = %46, %42
%51 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
%52 = load i32, i32* %51
%53 = call signext i8 @MAJOR(i32 %52)
%54 = load i32, i32* %51
%55 = call signext i8 @MINOR(i32 %54)
br label %56
56: ; preds = %12, %33, %37, %50
%57 = phi i8 [ %35, %50 ], [ %35, %37 ], [ %35, %33 ], [ 6, %12 ]
%58 = phi i8 [ %34, %50 ], [ %34, %37 ], [ %34, %33 ], [ 3, %12 ]
%59 = phi i8 [ %53, %50 ], [ 0, %37 ], [ 0, %33 ], [ 0, %12 ]
%60 = phi i8 [ %55, %50 ], [ 0, %37 ], [ 0, %33 ], [ 0, %12 ]
%61 = load i32, i32* @stderr
%62 = sext i8 %58 to i32
%63 = sext i8 %57 to i32
%64 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %62, i32 %63)
%65 = load i32, i32* @stderr
%66 = sext i8 %59 to i32
%67 = sext i8 %60 to i32
%68 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %66, i32 %67)
switch i8 %58, label %69 [
i8 3, label %73
i8 2, label %73
i8 0, label %73
]
69: ; preds = %56
%70 = load i32, i32* @stderr
%71 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i32 %62)
%72 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %73
73: ; preds = %56, %56, %56, %69
switch i8 %59, label %74 [
i8 3, label %78
i8 0, label %78
]
74: ; preds = %73
%75 = load i32, i32* @stderr
%76 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i32 %66)
%77 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %78
78: ; preds = %73, %73, %74
%79 = getelementptr inbounds i8*, i8** %1, i64 1
%80 = load i8*, i8** %79
%81 = load i32, i32* @O_RDONLY
%82 = call i32 @open(i8* %80, i32 %81, i32 0)
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %86
84: ; preds = %78
%85 = call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
br label %86
86: ; preds = %84, %78
%87 = call i32 @read(i32 %82, i8* %6, i32 32)
%88 = icmp eq i32 %87, 32
br i1 %88, label %91, label %89
89: ; preds = %86
%90 = call i32 @die(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
br label %91
91: ; preds = %89, %86
%92 = bitcast [1024 x i8]* %3 to i64*
%93 = load i64, i64* %92
%94 = icmp eq i64 %93, 68158209
br i1 %94, label %97, label %95
95: ; preds = %91
%96 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
br label %97
97: ; preds = %95, %91
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 8
%99 = bitcast i8* %98 to i64*
%100 = load i64, i64* %99
%101 = icmp eq i64 %100, 32
br i1 %101, label %104, label %102
102: ; preds = %97
%103 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
br label %104
104: ; preds = %102, %97
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 24
%106 = bitcast i8* %105 to i64*
%107 = load i64, i64* %106
%108 = icmp eq i64 %107, 0
br i1 %108, label %111, label %109
109: ; preds = %104
%110 = call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
br label %111
111: ; preds = %109, %104
%112 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 32
%113 = bitcast i8* %112 to i64*
%114 = load i64, i64* %113
%115 = icmp eq i64 %114, 0
br i1 %115, label %118, label %116
116: ; preds = %111
%117 = call i32 @die(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0))
br label %118
118: ; preds = %116, %111
%119 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 40
%120 = bitcast i8* %119 to i64*
%121 = load i64, i64* %120
%122 = icmp eq i64 %121, 0
br i1 %122, label %125, label %123
123: ; preds = %118
%124 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
br label %125
125: ; preds = %123, %118
%126 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 56
%127 = bitcast i8* %126 to i64*
%128 = load i64, i64* %127
%129 = icmp eq i64 %128, 0
br i1 %129, label %132, label %130
130: ; preds = %125
%131 = call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0))
br label %132
132: ; preds = %130, %125
%133 = call i32 @read(i32 %82, i8* %6, i32 1024)
%134 = load i32, i32* @stderr
%135 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %134, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %133)
%136 = icmp eq i32 %133, 512
br i1 %136, label %139, label %137
137: ; preds = %132
%138 = call i32 @die(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.15, i64 0, i64 0))
br label %139
139: ; preds = %137, %132
%140 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 510
%141 = bitcast i8* %140 to i16*
%142 = load i16, i16* %141
%143 = icmp eq i16 %142, -21931
br i1 %143, label %146, label %144
144: ; preds = %139
%145 = call i32 @die(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.16, i64 0, i64 0))
br label %146
146: ; preds = %144, %139
%147 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 506
store i8 %60, i8* %147
%148 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 507
store i8 %59, i8* %148
%149 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 508
store i8 %57, i8* %149
%150 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 509
store i8 %58, i8* %150
%151 = call i32 @write(i32 1, i8* %6, i32 512)
%152 = icmp eq i32 %151, 512
br i1 %152, label %155, label %153
153: ; preds = %146
%154 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0))
br label %155
155: ; preds = %153, %146
%156 = call i32 @close(i32 %82)
%157 = getelementptr inbounds i8*, i8** %1, i64 2
%158 = load i8*, i8** %157
%159 = load i32, i32* @O_RDONLY
%160 = call i32 @open(i8* %158, i32 %159, i32 0)
%161 = icmp slt i32 %160, 0
br i1 %161, label %162, label %164
162: ; preds = %155
%163 = call i32 @die(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0))
br label %164
164: ; preds = %162, %155
%165 = call i32 @read(i32 %160, i8* %6, i32 32)
%166 = icmp eq i32 %165, 32
br i1 %166, label %169, label %167
167: ; preds = %164
%168 = call i32 @die(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.19, i64 0, i64 0))
br label %169
169: ; preds = %167, %164
%170 = load i64, i64* %92
%171 = icmp eq i64 %170, 68158209
br i1 %171, label %174, label %172
172: ; preds = %169
%173 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
br label %174
174: ; preds = %172, %169
%175 = load i64, i64* %99
%176 = icmp eq i64 %175, 32
br i1 %176, label %179, label %177
177: ; preds = %174
%178 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
br label %179
179: ; preds = %177, %174
%180 = load i64, i64* %106
%181 = icmp eq i64 %180, 0
br i1 %181, label %184, label %182
182: ; preds = %179
%183 = call i32 @die(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.21, i64 0, i64 0))
br label %184
184: ; preds = %182, %179
%185 = load i64, i64* %113
%186 = icmp eq i64 %185, 0
br i1 %186, label %189, label %187
187: ; preds = %184
%188 = call i32 @die(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.22, i64 0, i64 0))
br label %189
189: ; preds = %187, %184
%190 = load i64, i64* %120
%191 = icmp eq i64 %190, 0
br i1 %191, label %194, label %192
192: ; preds = %189
%193 = call i32 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
br label %194
194: ; preds = %192, %189
%195 = load i64, i64* %127
%196 = icmp eq i64 %195, 0
br i1 %196, label %199, label %197
197: ; preds = %194
%198 = call i32 @die(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.23, i64 0, i64 0))
br label %199
199: ; preds = %197, %194
%200 = call i32 @read(i32 %160, i8* %6, i32 1024)
%201 = icmp sgt i32 %200, 0
br i1 %201, label %204, label %202
202: ; preds = %199
%203 = call i32 @close(i32 %160)
br label %220
204: ; preds = %199, %211
%205 = phi i32 [ %213, %211 ], [ %200, %199 ]
%206 = phi i32 [ %212, %211 ], [ 0, %199 ]
%207 = call i32 @write(i32 1, i8* %6, i32 %205)
%208 = icmp eq i32 %207, %205
br i1 %208, label %211, label %209
209: ; preds = %204
%210 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0))
br label %211
211: ; preds = %204, %209
%212 = add nsw i32 %205, %206
%213 = call i32 @read(i32 %160, i8* %6, i32 1024)
%214 = icmp sgt i32 %213, 0
br i1 %214, label %204, label %215
215: ; preds = %211
%216 = call i32 @close(i32 %160)
%217 = icmp sgt i32 %212, 2048
br i1 %217, label %218, label %220
218: ; preds = %215
%219 = call i32 @die(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.24, i64 0, i64 0))
br label %220
220: ; preds = %202, %218, %215
%221 = phi i32 [ 0, %202 ], [ %212, %218 ], [ %212, %215 ]
%222 = load i32, i32* @stderr
%223 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %222, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.25, i64 0, i64 0), i32 %221)
%224 = icmp slt i32 %221, 2048
br i1 %224, label %225, label %237
225: ; preds = %220, %234
%226 = phi i32 [ %235, %234 ], [ %221, %220 ]
%227 = sub nsw i32 2048, %226
%228 = icmp ult i32 %227, 1024
%229 = select i1 %228, i32 %227, i32 1024
%230 = call i32 @write(i32 1, i8* %6, i32 %229)
%231 = icmp eq i32 %230, %229
br i1 %231, label %234, label %232
232: ; preds = %225
%233 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0))
br label %234
234: ; preds = %232, %225
%235 = add nsw i32 %229, %226
%236 = icmp slt i32 %235, 2048
br i1 %236, label %225, label %237
237: ; preds = %234, %220
%238 = getelementptr inbounds i8*, i8** %1, i64 3
%239 = load i8*, i8** %238
%240 = load i32, i32* @O_RDONLY
%241 = call i32 @open(i8* %239, i32 %240, i32 0)
%242 = icmp slt i32 %241, 0
br i1 %242, label %243, label %245
243: ; preds = %237
%244 = call i32 @die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.26, i64 0, i64 0))
br label %245
245: ; preds = %243, %237
%246 = call i32 @read(i32 %241, i8* %6, i32 1024)
%247 = icmp eq i32 %246, 1024
br i1 %247, label %250, label %248
248: ; preds = %245
%249 = call i32 @die(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.27, i64 0, i64 0))
br label %250
250: ; preds = %248, %245
%251 = load i64, i64* %120
%252 = icmp eq i64 %251, 0
br i1 %252, label %255, label %253
253: ; preds = %250
%254 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.28, i64 0, i64 0))
br label %255
255: ; preds = %253, %250
%256 = call i32 @read(i32 %241, i8* %6, i32 1024)
%257 = icmp sgt i32 %256, 0
br i1 %257, label %258, label %269
258: ; preds = %255, %265
%259 = phi i32 [ %267, %265 ], [ %256, %255 ]
%260 = phi i32 [ %266, %265 ], [ 0, %255 ]
%261 = call i32 @write(i32 1, i8* %6, i32 %259)
%262 = icmp eq i32 %261, %259
br i1 %262, label %265, label %263
263: ; preds = %258
%264 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0))
br label %265
265: ; preds = %258, %263
%266 = add nsw i32 %259, %260
%267 = call i32 @read(i32 %241, i8* %6, i32 1024)
%268 = icmp sgt i32 %267, 0
br i1 %268, label %258, label %269
269: ; preds = %265, %255
%270 = phi i32 [ 0, %255 ], [ %266, %265 ]
%271 = call i32 @close(i32 %241)
%272 = load i32, i32* @stderr
%273 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %272, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.29, i64 0, i64 0), i32 %270)
%274 = icmp sgt i32 %270, 196608
br i1 %274, label %275, label %277
275: ; preds = %269
%276 = call i32 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.30, i64 0, i64 0))
br label %277
277: ; preds = %275, %269
ret i32 0
}