#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(unsigned char *, char *);
int main(int argc, char *argv[]) {
  FILE *in, *out;
  static unsigned char buf[512 * 9];
  unsigned char *bp;
  int track, sector;
  strcpy(buf, "MV - CPCEMU Disk-File\r\nDisk-Info\r\n");
  buf[0x30] = 40;
  buf[0x31] = 1;
  buf[0x32] = 0;
  buf[0x33] = 13;
  if (argc != 3) {
    fprintf(stderr, "%s: source dest.\n", argv[0]);
    exit(1);
  }
  in = fopen(argv[1], "r");
  if (in == NULL) {
    perror(argv[1]);
    exit(1);
  }
  out = fopen(argv[2], "w");
  if (out == NULL) {
    perror(argv[2]);
    exit(1);
  }
  if (fwrite(buf, 256, 1, out) != 1) {
    perror(argv[2]);
    exit(1);
  }
  for (track = 0; track < 40; track++) {
    memset(buf, 0, 512);
    strcpy(buf, "Track-Info\r\n");
    buf[0x10] = track;
    buf[0x11] = 0;
    buf[0x14] = 2;
    buf[0x15] = 9;
    buf[0x16] = 0x4E;
    buf[0x17] = 0xE5;
    bp = buf + 0x18;
    for (sector = 1; sector < 10; sector++) {
      *bp++ = track;
      *bp++ = 0;
      *bp++ = sector;
      *bp++ = 2;
      *bp++ = 0;
      *bp++ = 0;
      *bp++ = 0;
      *bp++ = 0;
    }
    if (fwrite(buf, 256, 1, out) != 1) {
      perror(argv[2]);
      exit(1);
    }
    if (fread(buf, 512, 9, in) != 9) {
      perror(argv[1]);
      exit(1);
    }
    if (fwrite(buf, 512, 9, out) != 9) {
      perror(argv[2]);
      exit(1);
    }
  }
  if (fclose(in)) {
    perror(argv[1]);
    exit(1);
  }
  if (fclose(out)) {
    perror(argv[2]);
    exit(1);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0x2ed3(%rip),%rdi
lea    0xe4c(%rip),%rsi
call   1030 <strcpy@plt>
movb   $0x28,0x2ef0(%rip)
movb   $0x1,0x2eea(%rip)
movb   $0x0,0x2ee4(%rip)
movb   $0xd,0x2ede(%rip)
cmpl   $0x3,-0x8(%rbp)
je     1205 <main+0x75>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe2d(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe21(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    123f <main+0xaf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xde9(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1279 <main+0xe9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%rcx
lea    0x2dfc(%rip),%rdi
mov    $0x100,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     12b3 <main+0x123>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x28,-0x2c(%rbp)
jge    149d <main+0x30d>
lea    0x2db5(%rip),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1060 <memset@plt>
lea    0x2da2(%rip),%rdi
lea    0xd54(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x2c(%rbp),%eax
mov    %al,0x2d9d(%rip)
movb   $0x0,0x2d97(%rip)
movb   $0x2,0x2d93(%rip)
movb   $0x9,0x2d8d(%rip)
movb   $0x4e,0x2d87(%rip)
movb   $0xe5,0x2d81(%rip)
lea    0x2d63(%rip),%rax
add    $0x18,%rax
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x30(%rbp)
cmpl   $0xa,-0x30(%rbp)
jge    13dc <main+0x24c>
mov    -0x2c(%rbp),%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x0,(%rax)
mov    -0x30(%rbp),%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x2,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x0,(%rax)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    132c <main+0x19c>
mov    -0x20(%rbp),%rcx
lea    0x2c99(%rip),%rdi
mov    $0x100,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
je     1416 <main+0x286>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x18(%rbp),%rcx
lea    0x2c5f(%rip),%rdi
mov    $0x200,%esi
mov    $0x9,%edx
call   1040 <fread@plt>
cmp    $0x9,%eax
je     1450 <main+0x2c0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%rcx
lea    0x2c25(%rip),%rdi
mov    $0x200,%esi
mov    $0x9,%edx
call   10b0 <fwrite@plt>
cmp    $0x9,%eax
je     148a <main+0x2fa>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    148f <main+0x2ff>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12ba <main+0x12a>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
cmp    $0x0,%rax
je     14c7 <main+0x337>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
cmp    $0x0,%rax
je     14f1 <main+0x361>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
lea    0x2ed9(%rip),%rdi
lea    0xe52(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0xd000128,0x2ef3(%rip)
cmp    $0x3,%ebx
jne    11e0 <main+0x50>
mov    0x8(%r14),%rdi
lea    0xe68(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
jne    1202 <main+0x72>
mov    0x8(%r14),%rdi
jmp    1442 <main+0x2b2>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe30(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    %rax,%r15
mov    0x10(%r14),%rdi
lea    0xe27(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     143e <main+0x2ae>
mov    %rax,%r12
lea    0x2e58(%rip),%rdi
mov    $0x100,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
jne    143e <main+0x2ae>
xor    %ebp,%ebp
lea    0x2e34(%rip),%rbx
lea    0xde6(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1060 <memset@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    %bpl,0x2e0f(%rip)
movb   $0x0,0x2e09(%rip)
movl   $0xe54e0902,0x2e02(%rip)
09 4e e5
mov    %bpl,0x2dff(%rip)
movw   $0x100,0x2df7(%rip)
movb   $0x2,0x2df2(%rip)
movl   $0x0,0x2de9(%rip)
mov    %bpl,0x2de6(%rip)
movw   $0x200,0x2dde(%rip)
movb   $0x2,0x2dd9(%rip)
movl   $0x0,0x2dd0(%rip)
mov    %bpl,0x2dcd(%rip)
movw   $0x300,0x2dc5(%rip)
movb   $0x2,0x2dc0(%rip)
movl   $0x0,0x2db7(%rip)
mov    %bpl,0x2db4(%rip)
movw   $0x400,0x2dac(%rip)
movb   $0x2,0x2da7(%rip)
movl   $0x0,0x2d9e(%rip)
mov    %bpl,0x2d9b(%rip)
movw   $0x500,0x2d93(%rip)
movb   $0x2,0x2d8e(%rip)
movl   $0x0,0x2d85(%rip)
mov    %bpl,0x2d82(%rip)
movw   $0x600,0x2d7a(%rip)
movb   $0x2,0x2d75(%rip)
movl   $0x0,0x2d6c(%rip)
mov    %bpl,0x2d69(%rip)
movw   $0x700,0x2d61(%rip)
movb   $0x2,0x2d5c(%rip)
movl   $0x0,0x2d53(%rip)
mov    %bpl,0x2d50(%rip)
movw   $0x800,0x2d48(%rip)
movb   $0x2,0x2d43(%rip)
movl   $0x0,0x2d3a(%rip)
mov    %bpl,0x2d37(%rip)
movw   $0x900,0x2d2f(%rip)
movb   $0x2,0x2d2a(%rip)
movl   $0x0,0x2d21(%rip)
mov    %rbx,%rdi
mov    $0x100,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10b0 <fwrite@plt>
cmp    $0x1,%eax
jne    143e <main+0x2ae>
mov    %rbx,%rdi
mov    $0x200,%esi
mov    $0x9,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
cmp    $0x9,%eax
jne    11d7 <main+0x47>
mov    %rbx,%rdi
mov    $0x200,%esi
mov    $0x9,%edx
mov    %r12,%rcx
call   10b0 <fwrite@plt>
cmp    $0x9,%eax
jne    143e <main+0x2ae>
add    $0x1,%ebp
cmp    $0x28,%ebp
jne    1260 <main+0xd0>
mov    %r15,%rdi
call   1050 <fclose@plt>
test   %rax,%rax
jne    11d7 <main+0x47>
mov    %r12,%rdi
call   1050 <fclose@plt>
test   %rax,%rax
jne    143e <main+0x2ae>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    0x10(%r14),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@main.buf = internal global [4608 x i8] zeroinitializer
@.str = [35 x i8] c"MV - CPCEMU Disk-File\0D\0ADisk-Info\0D\0A\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"%s: source dest.\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [13 x i8] c"Track-Info\0D\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 @strcpy(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i8 40, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 48)
store i8 1, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 49)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 50)
store i8 13, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 51)
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %21
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %25, i32** %6
%26 = load i32*, i32** %6
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %34
28: ; preds = %21
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @perror(i8* %31)
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %21
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i32* @fopen(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %38, i32** %7
%39 = load i32*, i32** %7
%40 = icmp eq i32* %39, null
br i1 %40, label %41, label %47
41: ; preds = %34
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
%45 = call i32 @perror(i8* %44)
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %34
%48 = load i32*, i32** %7
%49 = call i32 @fwrite(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i32 256, i32 1, i32* %48)
%50 = icmp ne i32 %49, 1
br i1 %50, label %51, label %57
51: ; preds = %47
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i32 @perror(i8* %54)
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %47
store i32 0, i32* %9
br label %58
58: ; preds = %124, %57
%59 = load i32, i32* %9
%60 = icmp slt i32 %59, 40
br i1 %60, label %61, label %127
61: ; preds = %58
%62 = call i32 @memset(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i32 0, i32 512)
%63 = call i32 @strcpy(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%64 = load i32, i32* %9
%65 = trunc i32 %64 to i8
store i8 %65, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 16)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 17)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 20)
store i8 9, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 21)
store i8 78, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 22)
store i8 -27, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 23)
store i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 24), i8** %8
store i32 1, i32* %10
br label %66
66: ; preds = %90, %61
%67 = load i32, i32* %10
%68 = icmp slt i32 %67, 10
br i1 %68, label %69, label %93
69: ; preds = %66
%70 = load i32, i32* %9
%71 = trunc i32 %70 to i8
%72 = load i8*, i8** %8
%73 = getelementptr inbounds i8, i8* %72, i32 1
store i8* %73, i8** %8
store i8 %71, i8* %72
%74 = load i8*, i8** %8
%75 = getelementptr inbounds i8, i8* %74, i32 1
store i8* %75, i8** %8
store i8 0, i8* %74
%76 = load i32, i32* %10
%77 = trunc i32 %76 to i8
%78 = load i8*, i8** %8
%79 = getelementptr inbounds i8, i8* %78, i32 1
store i8* %79, i8** %8
store i8 %77, i8* %78
%80 = load i8*, i8** %8
%81 = getelementptr inbounds i8, i8* %80, i32 1
store i8* %81, i8** %8
store i8 2, i8* %80
%82 = load i8*, i8** %8
%83 = getelementptr inbounds i8, i8* %82, i32 1
store i8* %83, i8** %8
store i8 0, i8* %82
%84 = load i8*, i8** %8
%85 = getelementptr inbounds i8, i8* %84, i32 1
store i8* %85, i8** %8
store i8 0, i8* %84
%86 = load i8*, i8** %8
%87 = getelementptr inbounds i8, i8* %86, i32 1
store i8* %87, i8** %8
store i8 0, i8* %86
%88 = load i8*, i8** %8
%89 = getelementptr inbounds i8, i8* %88, i32 1
store i8* %89, i8** %8
store i8 0, i8* %88
br label %90
90: ; preds = %69
%91 = load i32, i32* %10
%92 = add nsw i32 %91, 1
store i32 %92, i32* %10
br label %66
93: ; preds = %66
%94 = load i32*, i32** %7
%95 = call i32 @fwrite(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i32 256, i32 1, i32* %94)
%96 = icmp ne i32 %95, 1
br i1 %96, label %97, label %103
97: ; preds = %93
%98 = load i8**, i8*** %5
%99 = getelementptr inbounds i8*, i8** %98, i64 2
%100 = load i8*, i8** %99
%101 = call i32 @perror(i8* %100)
%102 = call i32 @exit(i32 1)
unreachable
103: ; preds = %93
%104 = load i32*, i32** %6
%105 = call i32 @fread(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i32 512, i32 9, i32* %104)
%106 = icmp ne i32 %105, 9
br i1 %106, label %107, label %113
107: ; preds = %103
%108 = load i8**, i8*** %5
%109 = getelementptr inbounds i8*, i8** %108, i64 1
%110 = load i8*, i8** %109
%111 = call i32 @perror(i8* %110)
%112 = call i32 @exit(i32 1)
unreachable
113: ; preds = %103
%114 = load i32*, i32** %7
%115 = call i32 @fwrite(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i32 512, i32 9, i32* %114)
%116 = icmp ne i32 %115, 9
br i1 %116, label %117, label %123
117: ; preds = %113
%118 = load i8**, i8*** %5
%119 = getelementptr inbounds i8*, i8** %118, i64 2
%120 = load i8*, i8** %119
%121 = call i32 @perror(i8* %120)
%122 = call i32 @exit(i32 1)
unreachable
123: ; preds = %113
br label %124
124: ; preds = %123
%125 = load i32, i32* %9
%126 = add nsw i32 %125, 1
store i32 %126, i32* %9
br label %58
127: ; preds = %58
%128 = load i32*, i32** %6
%129 = call i64 @fclose(i32* %128)
%130 = icmp ne i64 %129, 0
br i1 %130, label %131, label %137
131: ; preds = %127
%132 = load i8**, i8*** %5
%133 = getelementptr inbounds i8*, i8** %132, i64 1
%134 = load i8*, i8** %133
%135 = call i32 @perror(i8* %134)
%136 = call i32 @exit(i32 1)
unreachable
137: ; preds = %127
%138 = load i32*, i32** %7
%139 = call i64 @fclose(i32* %138)
%140 = icmp ne i64 %139, 0
br i1 %140, label %141, label %147
141: ; preds = %137
%142 = load i8**, i8*** %5
%143 = getelementptr inbounds i8*, i8** %142, i64 2
%144 = load i8*, i8** %143
%145 = call i32 @perror(i8* %144)
%146 = call i32 @exit(i32 1)
unreachable
147: ; preds = %137
%148 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@main.buf = internal global [4608 x i8] zeroinitializer
@.str = [35 x i8] c"MV - CPCEMU Disk-File\0D\0ADisk-Info\0D\0A\00"
@stderr = global i32 0
@.str.1 = [18 x i8] c"%s: source dest.\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [13 x i8] c"Track-Info\0D\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @strcpy(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i8 40, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 48)
store i8 1, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 49)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 50)
store i8 13, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 51)
%4 = icmp eq i32 %0, 3
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %19
15: ; preds = %10
%16 = load i8*, i8** %11
%17 = tail call i32 @perror(i8* %16)
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %10
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load i8*, i8** %20
%26 = tail call i32 @perror(i8* %25)
%27 = tail call i32 @exit(i32 1)
unreachable
28: ; preds = %19
%29 = tail call i32 @fwrite(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i32 256, i32 1, i32* %22)
%30 = icmp eq i32 %29, 1
br i1 %30, label %38, label %31
31: ; preds = %28
%32 = load i8*, i8** %20
%33 = tail call i32 @perror(i8* %32)
%34 = tail call i32 @exit(i32 1)
unreachable
35: ; preds = %56
%36 = add nuw nsw i32 %39, 1
%37 = icmp eq i32 %36, 40
br i1 %37, label %63, label %38
38: ; preds = %28, %35
%39 = phi i32 [ %36, %35 ], [ 0, %28 ]
%40 = tail call i32 @memset(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i32 0, i32 512)
%41 = tail call i32 @strcpy(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%42 = trunc i32 %39 to i8
store i8 %42, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 16)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 17)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 20)
store i8 9, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 21)
store i8 78, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 22)
store i8 -27, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 23)
store i8 %42, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 24)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 25)
store i8 1, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 26)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 27)
store i32 0, i32* bitcast (i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 28) to i32*)
store i8 %42, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 32)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 33)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 34)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 35)
store i32 0, i32* bitcast (i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 36) to i32*)
store i8 %42, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 40)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 41)
store i8 3, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 42)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 43)
store i32 0, i32* bitcast (i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 44) to i32*)
store i8 %42, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 48)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 49)
store i8 4, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 50)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 51)
store i32 0, i32* bitcast (i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 52) to i32*)
store i8 %42, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 56)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 57)
store i8 5, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 58)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 59)
store i32 0, i32* bitcast (i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 60) to i32*)
store i8 %42, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 64)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 65)
store i8 6, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 66)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 67)
store i32 0, i32* bitcast (i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 68) to i32*)
store i8 %42, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 72)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 73)
store i8 7, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 74)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 75)
store i32 0, i32* bitcast (i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 76) to i32*)
store i8 %42, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 80)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 81)
store i8 8, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 82)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 83)
store i32 0, i32* bitcast (i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 84) to i32*)
store i8 %42, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 88)
store i8 0, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 89)
store i8 9, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 90)
store i8 2, i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 91)
store i32 0, i32* bitcast (i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 92) to i32*)
%43 = tail call i32 @fwrite(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i32 256, i32 1, i32* %22)
%44 = icmp eq i32 %43, 1
br i1 %44, label %49, label %45
45: ; preds = %38
%46 = load i8*, i8** %20
%47 = tail call i32 @perror(i8* %46)
%48 = tail call i32 @exit(i32 1)
unreachable
49: ; preds = %38
%50 = tail call i32 @fread(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i32 512, i32 9, i32* %13)
%51 = icmp eq i32 %50, 9
br i1 %51, label %56, label %52
52: ; preds = %49
%53 = load i8*, i8** %11
%54 = tail call i32 @perror(i8* %53)
%55 = tail call i32 @exit(i32 1)
unreachable
56: ; preds = %49
%57 = tail call i32 @fwrite(i8* getelementptr inbounds ([4608 x i8], [4608 x i8]* @main.buf, i64 0, i64 0), i32 512, i32 9, i32* %22)
%58 = icmp eq i32 %57, 9
br i1 %58, label %35, label %59
59: ; preds = %56
%60 = load i8*, i8** %20
%61 = tail call i32 @perror(i8* %60)
%62 = tail call i32 @exit(i32 1)
unreachable
63: ; preds = %35
%64 = tail call i64 @fclose(i32* %13)
%65 = icmp eq i64 %64, 0
br i1 %65, label %70, label %66
66: ; preds = %63
%67 = load i8*, i8** %11
%68 = tail call i32 @perror(i8* %67)
%69 = tail call i32 @exit(i32 1)
unreachable
70: ; preds = %63
%71 = tail call i64 @fclose(i32* %22)
%72 = icmp eq i64 %71, 0
br i1 %72, label %77, label %73
73: ; preds = %70
%74 = load i8*, i8** %20
%75 = tail call i32 @perror(i8* %74)
%76 = tail call i32 @exit(i32 1)
unreachable
77: ; preds = %70
%78 = tail call i32 @exit(i32 0)
unreachable
}