#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 adfs_format(char *, int /*<<< orphan*/ *, int);
char *alloca(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int parse_size(char *);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int strlen(char const *);
int main(int argc, char **argv) {
  const char *fn;
  int status, len, size, sectors, cyl;
  char *dat_fn, *dsc_fn, geom[22];
  FILE *dat_fp, *dsc_fp;
  if (argc == 3) {
    size = parse_size(argv[2]);
    if (size > 0) {
      fn = argv[1];
      len = strlen(fn) + 5;
      dat_fn = alloca(len);
      snprintf(dat_fn, len, "%s.dat", fn);
      dsc_fn = alloca(len);
      snprintf(dsc_fn, len, "%s.dsc", fn);
      if ((dat_fp = fopen(dat_fn, "wb"))) {
        if ((dsc_fp = fopen(dsc_fn, "wb"))) {
          sectors = size / 256;
          cyl = 1 + ((sectors - 1) / (33 * 255));
          printf("size=%d, sectors=%d, cyl=%d\n", size, sectors, cyl);
          geom[13] = cyl % 256;
          geom[14] = cyl / 256;
          geom[15] = 255;
          if (fwrite(geom, sizeof geom, 1, dsc_fp) != 1) {
            fprintf(stderr, "hdfmt: unable to write to dsc file %s: %s\n",
                    dsc_fn, strerror(errno));
            status = 1;
          }
          fclose(dsc_fp);
          status = adfs_format(dat_fn, dat_fp, sectors);
        } else {
          fprintf(stderr, "hdfmt: unable to create dsc file %s: %s\n", dsc_fn,
                  strerror(errno));
          status = 2;
        }
        fclose(dat_fp);
      } else {
        fprintf(stderr, "hdfmt: unable to create data file %s: %s\n", dat_fn,
                strerror(errno));
        status = 2;
      }
    } else {
      fprintf(stderr, "hdfmt: %s is not a valid size\n", argv[2]);
      status = 1;
    }
  } else {
    fputs("usage: hdfmt <dat-file> <size>\n", stderr);
    status = 1;
  }
  return status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    144d <main+0x28d>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <parse_size@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    1422 <main+0x262>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x5,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
call   10a0 <alloca@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rcx
lea    0xdca(%rip),%rdx
call   1070 <snprintf@plt>
mov    -0x20(%rbp),%edi
call   10a0 <alloca@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rcx
lea    0xdae(%rip),%rdx
call   1070 <snprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xda5(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x68(%rbp)
cmp    $0x0,%rax
je     13d0 <main+0x210>
mov    -0x40(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x70(%rbp)
cmp    $0x0,%rax
je     1375 <main+0x1b5>
mov    -0x24(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    $0x20df,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
lea    0xd45(%rip),%rdi
call   1060 <printf@plt>
mov    -0x2c(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x53(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %al,-0x52(%rbp)
movb   $0xff,-0x51(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x70(%rbp),%rcx
mov    $0x16,%esi
mov    $0x1,%edx
call   10d0 <fwrite@plt>
cmp    $0x1,%eax
je     1354 <main+0x194>
mov    0x2cc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    0x2caa(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rdx
mov    %rax,%rcx
lea    0xce8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x70(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x38(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   1030 <adfs_format@plt>
mov    %eax,-0x1c(%rbp)
jmp    13c2 <main+0x202>
mov    0x2c64(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rdx
mov    %rax,%rcx
lea    0xca5(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x1c(%rbp)
mov    -0x68(%rbp),%rdi
call   1040 <fclose@plt>
jmp    141d <main+0x25d>
mov    0x2c09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    0x2be7(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rdx
mov    %rax,%rcx
lea    0xc73(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x2,-0x1c(%rbp)
jmp    1448 <main+0x288>
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xc72(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x1c(%rbp)
jmp    1469 <main+0x2a9>
mov    0x2b8c(%rip),%rax
mov    (%rax),%esi
lea    0xc6e(%rip),%rdi
call   1080 <fputs@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x3,%edi
jne    1316 <main+0x156>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   10b0 <parse_size@plt>
test   %eax,%eax
jle    132d <main+0x16d>
mov    %eax,%r15d
mov    0x8(%rbx),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0x5(%rax),%ebp
mov    %ebp,%edi
call   10a0 <alloca@plt>
mov    %rax,%r14
lea    0xdf2(%rip),%rdx
mov    %rax,%rdi
mov    %ebp,%esi
mov    %rbx,%rcx
call   1070 <snprintf@plt>
mov    %ebp,%edi
call   10a0 <alloca@plt>
mov    %rax,%r12
lea    0xddb(%rip),%rdx
mov    %rax,%rdi
mov    %ebp,%esi
mov    %rbx,%rcx
call   1070 <snprintf@plt>
lea    0xdce(%rip),%rsi
mov    %r14,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     134f <main+0x18f>
mov    %rax,%rbp
lea    0xdb3(%rip),%rsi
mov    %r12,%rdi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1383 <main+0x1c3>
mov    %rax,%r13
mov    %r15d,%esi
shr    $0x8,%r15d
lea    -0x1(%r15),%eax
cltq
imul   $0x3e4dd1b3,%rax,%rax
mov    %rax,%rcx
sar    $0x2b,%rcx
shr    $0x3f,%rax
lea    (%rcx,%rax,1),%ebx
add    $0x1,%ebx
lea    0xd76(%rip),%rdi
mov    %r15d,%edx
mov    %ebx,%ecx
call   1060 <printf@plt>
mov    %bl,0xd(%rsp)
mov    %bh,0xe(%rsp)
movb   $0xff,0xf(%rsp)
mov    %rsp,%rdi
mov    $0x16,%esi
mov    $0x1,%edx
mov    %r13,%rcx
call   10d0 <fwrite@plt>
cmp    $0x1,%eax
je     12f9 <main+0x139>
mov    0x2d0d(%rip),%rax
mov    (%rax),%ebx
mov    0x2cfc(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd44(%rip),%rsi
mov    %ebx,%edi
mov    %r12,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
call   1030 <adfs_format@plt>
mov    %eax,%ebx
jmp    13b5 <main+0x1f5>
mov    0x2cc3(%rip),%rax
mov    (%rax),%esi
lea    0xda5(%rip),%rdi
call   1080 <fputs@plt>
jmp    1348 <main+0x188>
mov    0x2cac(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xd6b(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%ebx
jmp    13bd <main+0x1fd>
mov    0x2c8a(%rip),%rax
mov    (%rax),%ebx
mov    0x2c79(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd15(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%ebx
jmp    13bd <main+0x1fd>
mov    0x2c56(%rip),%rax
mov    (%rax),%ebx
mov    0x2c45(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xcb8(%rip),%rsi
mov    %ebx,%edi
mov    %r12,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%ebx
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s.dat\00"
@.str.1 = [7 x i8] c"%s.dsc\00"
@.str.2 = [3 x i8] c"wb\00"
@.str.3 = [29 x i8] c"size=%d, sectors=%d, cyl=%d\0A\00"
@stderr = global i32 0
@.str.4 = [43 x i8] c"hdfmt: unable to write to dsc file %s: %s\0A\00"
@errno = global i32 0
@.str.5 = [41 x i8] c"hdfmt: unable to create dsc file %s: %s\0A\00"
@.str.6 = [42 x i8] c"hdfmt: unable to create data file %s: %s\0A\00"
@.str.7 = [31 x i8] c"hdfmt: %s is not a valid size\0A\00"
@.str.8 = [32 x i8] c"usage: hdfmt <dat-file> <size>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca [22 x i8]
%15 = alloca i32*
%16 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 3
br i1 %18, label %19, label %112
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @parse_size(i8* %22)
store i32 %23, i32* %9
%24 = load i32, i32* %9
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %105
26: ; preds = %19
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
store i8* %29, i8** %6
%30 = load i8*, i8** %6
%31 = call i32 @strlen(i8* %30)
%32 = add nsw i32 %31, 5
store i32 %32, i32* %8
%33 = load i32, i32* %8
%34 = call i8* @alloca(i32 %33)
store i8* %34, i8** %12
%35 = load i8*, i8** %12
%36 = load i32, i32* %8
%37 = load i8*, i8** %6
%38 = call i32 @snprintf(i8* %35, i32 %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %37)
%39 = load i32, i32* %8
%40 = call i8* @alloca(i32 %39)
store i8* %40, i8** %13
%41 = load i8*, i8** %13
%42 = load i32, i32* %8
%43 = load i8*, i8** %6
%44 = call i32 @snprintf(i8* %41, i32 %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %43)
%45 = load i8*, i8** %12
%46 = call i32* @fopen(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %46, i32** %15
%47 = icmp ne i32* %46, null
br i1 %47, label %48, label %98
48: ; preds = %26
%49 = load i8*, i8** %13
%50 = call i32* @fopen(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %50, i32** %16
%51 = icmp ne i32* %50, null
br i1 %51, label %52, label %89
52: ; preds = %48
%53 = load i32, i32* %9
%54 = sdiv i32 %53, 256
store i32 %54, i32* %10
%55 = load i32, i32* %10
%56 = sub nsw i32 %55, 1
%57 = sdiv i32 %56, 8415
%58 = add nsw i32 1, %57
store i32 %58, i32* %11
%59 = load i32, i32* %9
%60 = load i32, i32* %10
%61 = load i32, i32* %11
%62 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %59, i32 %60, i32 %61)
%63 = load i32, i32* %11
%64 = srem i32 %63, 256
%65 = trunc i32 %64 to i8
%66 = getelementptr inbounds [22 x i8], [22 x i8]* %14, i64 0, i64 13
store i8 %65, i8* %66
%67 = load i32, i32* %11
%68 = sdiv i32 %67, 256
%69 = trunc i32 %68 to i8
%70 = getelementptr inbounds [22 x i8], [22 x i8]* %14, i64 0, i64 14
store i8 %69, i8* %70
%71 = getelementptr inbounds [22 x i8], [22 x i8]* %14, i64 0, i64 15
store i8 -1, i8* %71
%72 = getelementptr inbounds [22 x i8], [22 x i8]* %14, i64 0, i64 0
%73 = load i32*, i32** %16
%74 = call i32 @fwrite(i8* %72, i32 22, i32 1, i32* %73)
%75 = icmp ne i32 %74, 1
br i1 %75, label %76, label %82
76: ; preds = %52
%77 = load i32, i32* @stderr
%78 = load i8*, i8** %13
%79 = load i32, i32* @errno
%80 = call i8* @strerror(i32 %79)
%81 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %78, i8* %80)
store i32 1, i32* %7
br label %82
82: ; preds = %76, %52
%83 = load i32*, i32** %16
%84 = call i32 @fclose(i32* %83)
%85 = load i8*, i8** %12
%86 = load i32*, i32** %15
%87 = load i32, i32* %10
%88 = call i32 @adfs_format(i8* %85, i32* %86, i32 %87)
store i32 %88, i32* %7
br label %95
89: ; preds = %48
%90 = load i32, i32* @stderr
%91 = load i8*, i8** %13
%92 = load i32, i32* @errno
%93 = call i8* @strerror(i32 %92)
%94 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* %91, i8* %93)
store i32 2, i32* %7
br label %95
95: ; preds = %89, %82
%96 = load i32*, i32** %15
%97 = call i32 @fclose(i32* %96)
br label %104
98: ; preds = %26
%99 = load i32, i32* @stderr
%100 = load i8*, i8** %12
%101 = load i32, i32* @errno
%102 = call i8* @strerror(i32 %101)
%103 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %100, i8* %102)
store i32 2, i32* %7
br label %104
104: ; preds = %98, %95
br label %111
105: ; preds = %19
%106 = load i32, i32* @stderr
%107 = load i8**, i8*** %5
%108 = getelementptr inbounds i8*, i8** %107, i64 2
%109 = load i8*, i8** %108
%110 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %109)
store i32 1, i32* %7
br label %111
111: ; preds = %105, %104
br label %115
112: ; preds = %2
%113 = load i32, i32* @stderr
%114 = call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i32 %113)
store i32 1, i32* %7
br label %115
115: ; preds = %112, %111
%116 = load i32, i32* %7
ret i32 %116
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s.dat\00"
@.str.1 = [7 x i8] c"%s.dsc\00"
@.str.2 = [3 x i8] c"wb\00"
@.str.3 = [29 x i8] c"size=%d, sectors=%d, cyl=%d\0A\00"
@stderr = global i32 0
@.str.4 = [43 x i8] c"hdfmt: unable to write to dsc file %s: %s\0A\00"
@errno = global i32 0
@.str.5 = [41 x i8] c"hdfmt: unable to create dsc file %s: %s\0A\00"
@.str.6 = [42 x i8] c"hdfmt: unable to create data file %s: %s\0A\00"
@.str.7 = [31 x i8] c"hdfmt: %s is not a valid size\0A\00"
@.str.8 = [32 x i8] c"usage: hdfmt <dat-file> <size>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [22 x i8]
%4 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %6, label %64
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @parse_size(i8* %8)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %60
11: ; preds = %6
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @strlen(i8* %13)
%15 = add nsw i32 %14, 5
%16 = tail call i8* @alloca(i32 %15)
%17 = tail call i32 @snprintf(i8* %16, i32 %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %13)
%18 = tail call i8* @alloca(i32 %15)
%19 = tail call i32 @snprintf(i8* %18, i32 %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%20 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %55, label %22
22: ; preds = %11
%23 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %47, label %25
25: ; preds = %22
%26 = lshr i32 %9, 8
%27 = add nsw i32 %26, -1
%28 = sdiv i32 %27, 8415
%29 = add nuw nsw i32 %28, 1
%30 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %9, i32 %26, i32 %29)
%31 = trunc i32 %29 to i8
%32 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 13
store i8 %31, i8* %32
%33 = lshr i32 %29, 8
%34 = trunc i32 %33 to i8
%35 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 14
store i8 %34, i8* %35
%36 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 15
store i8 -1, i8* %36
%37 = call i32 @fwrite(i8* %4, i32 22, i32 1, i32* %23)
%38 = icmp eq i32 %37, 1
br i1 %38, label %44, label %39
39: ; preds = %25
%40 = load i32, i32* @stderr
%41 = load i32, i32* @errno
%42 = tail call i8* @strerror(i32 %41)
%43 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %18, i8* %42)
br label %44
44: ; preds = %39, %25
%45 = tail call i32 @fclose(i32* %23)
%46 = tail call i32 @adfs_format(i8* %16, i32* %20, i32 %26)
br label %52
47: ; preds = %22
%48 = load i32, i32* @stderr
%49 = load i32, i32* @errno
%50 = tail call i8* @strerror(i32 %49)
%51 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* %18, i8* %50)
br label %52
52: ; preds = %47, %44
%53 = phi i32 [ %46, %44 ], [ 2, %47 ]
%54 = tail call i32 @fclose(i32* %20)
br label %67
55: ; preds = %11
%56 = load i32, i32* @stderr
%57 = load i32, i32* @errno
%58 = tail call i8* @strerror(i32 %57)
%59 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %16, i8* %58)
br label %67
60: ; preds = %6
%61 = load i32, i32* @stderr
%62 = load i8*, i8** %7
%63 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i8* %62)
br label %67
64: ; preds = %2
%65 = load i32, i32* @stderr
%66 = tail call i32 @fputs(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i32 %65)
br label %67
67: ; preds = %60, %55, %52, %64
%68 = phi i32 [ %53, %52 ], [ 2, %55 ], [ 1, %60 ], [ 1, %64 ]
ret i32 %68
}