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

/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ htobe32(int /*<<< orphan*/);
int /*<<< orphan*/ htole32(int /*<<< orphan*/);
int lseek(int, int, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
char *optarg;
int /*<<< orphan*/ perror(char *);
int read(int, char *, int);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int write(int, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  struct stat s;
  int c;
  int fd;
  uint32_t size = 0;
  char *file = NULL;
  int ret = 1;
  int is_bigendian = 0;
  char magic[8];
  int ignore_unknown = 0;
  while ((c = getopt(argc, argv, "if:b")) != -1) {
    switch (c) {
    case 'f':
      file = optarg;
      break;
    case 'b':
      is_bigendian = 1;
      break;
    case 'i':
      ignore_unknown = 1;
      break;
    }
  }
  if (!file) {
    fprintf(stderr, "missing file\n");
    return 1;
  }
  if (stat(file, &s)) {
    perror("stat");
    return 1;
  }
  fd = open(file, O_RDWR);
  if (fd < 0) {
    perror("open");
    return 1;
  }
  ret = lseek(fd, 0x20, SEEK_SET);
  if (ret < 0) {
    perror("lseek");
    ret = 1;
    goto err;
  }
  ret = read(fd, magic, sizeof(magic));
  if (ret < 0) {
    perror("read");
    ret = 1;
    goto err;
  }
  if (strcmp(magic, "barebox")) {
    if (ignore_unknown) {
      ret = 0;
    } else {
      fprintf(stderr, "invalid magic\n");
      ret = 1;
    }
    goto err;
  }
  ret = lseek(fd, 0x2c, SEEK_SET);
  if (ret < 0) {
    perror("lseek");
    ret = 1;
    goto err;
  }
  size = s.st_size;
  if (is_bigendian)
    size = htobe32(size);
  else
    size = htole32(size);
  ret = write(fd, &size, 4);
  if (ret != 4) {
    perror("write");
    ret = 1;
    goto err;
  }
  ret = 0;
err:
  close(fd);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x1,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdf8(%rip),%rdx
call   10e0 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     127a <main+0xba>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x48(%rbp)
sub    $0x62,%eax
je     1262 <main+0xa2>
jmp    122d <main+0x6d>
mov    -0x48(%rbp),%eax
sub    $0x66,%eax
je     124f <main+0x8f>
jmp    123e <main+0x7e>
mov    -0x48(%rbp),%eax
sub    $0x69,%eax
je     126e <main+0xae>
jmp    1275 <main+0xb5>
mov    0x2da2(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    1275 <main+0xb5>
movl   $0x1,-0x38(%rbp)
jmp    1275 <main+0xb5>
movl   $0x1,-0x44(%rbp)
jmp    11fa <main+0x3a>
cmpq   $0x0,-0x30(%rbp)
jne    12a6 <main+0xe6>
mov    0x2d44(%rip),%rax
mov    (%rax),%edi
lea    0xd70(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    147f <main+0x2bf>
mov    -0x30(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10a0 <stat@plt>
cmp    $0x0,%rax
je     12d5 <main+0x115>
lea    0xd4f(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    147f <main+0x2bf>
mov    -0x30(%rbp),%rdi
mov    0x2d00(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    130c <main+0x14c>
lea    0xd1d(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    147f <main+0x2bf>
mov    -0x20(%rbp),%edi
mov    0x2cb2(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1050 <lseek@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1347 <main+0x187>
lea    0xce7(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x34(%rbp)
jmp    1471 <main+0x2b1>
mov    -0x20(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x8,%edx
call   1070 <read@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    137d <main+0x1bd>
lea    0xcb7(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x34(%rbp)
jmp    1471 <main+0x2b1>
lea    -0x40(%rbp),%rdi
lea    0xca0(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     13ce <main+0x20e>
cmpl   $0x0,-0x44(%rbp)
je     13ad <main+0x1ed>
movl   $0x0,-0x34(%rbp)
jmp    13c9 <main+0x209>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
lea    0xc73(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0x1,-0x34(%rbp)
jmp    1471 <main+0x2b1>
mov    -0x20(%rbp),%edi
mov    0x2bf0(%rip),%rax
mov    (%rax),%edx
mov    $0x2c,%esi
call   1050 <lseek@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1409 <main+0x249>
lea    0xc25(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x34(%rbp)
jmp    1471 <main+0x2b1>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     1429 <main+0x269>
mov    -0x24(%rbp),%edi
call   10b0 <htobe32@plt>
mov    %eax,-0x24(%rbp)
jmp    1434 <main+0x274>
mov    -0x24(%rbp),%edi
call   1030 <htole32@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x24(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
je     146a <main+0x2aa>
lea    0xbe6(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x1,-0x34(%rbp)
jmp    1471 <main+0x2b1>
movl   $0x0,-0x34(%rbp)
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x0,0x4(%rsp)
xor    %r12d,%r12d
lea    0xe1b(%rip),%r15
xor    %r14d,%r14d
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   10e0 <getopt@plt>
cmp    $0x65,%eax
jg     1220 <main+0x60>
cmp    $0xffffffff,%eax
je     123e <main+0x7e>
cmp    $0x62,%eax
jne    11f0 <main+0x30>
mov    $0x1,%r12d
jmp    11f0 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x69,%eax
je     1236 <main+0x76>
cmp    $0x66,%eax
jne    11f0 <main+0x30>
mov    0x2dc7(%rip),%rax
mov    (%rax),%r14
jmp    11f0 <main+0x30>
mov    $0x1,%r13d
jmp    11f0 <main+0x30>
test   %r14,%r14
je     12ea <main+0x12a>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   10a0 <stat@plt>
test   %rax,%rax
jne    135f <main+0x19f>
mov    0x2d7c(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   10c0 <open@plt>
test   %eax,%eax
js     1368 <main+0x1a8>
mov    %eax,%ebx
mov    0x2d49(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %eax,%edi
mov    $0x20,%esi
call   1050 <lseek@plt>
test   %eax,%eax
js     1356 <main+0x196>
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0x8,%edx
call   1070 <read@plt>
test   %eax,%eax
js     137b <main+0x1bb>
lea    0xd72(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1309 <main+0x149>
xor    %ebp,%ebp
test   %r13d,%r13d
jne    138c <main+0x1cc>
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
lea    0xd50(%rip),%rsi
call   1090 <fprintf@plt>
jmp    1387 <main+0x1c7>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
lea    0xd0b(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%ebp
jmp    1393 <main+0x1d3>
mov    0x0(%rbp),%edx
mov    %ebx,%edi
mov    $0x2c,%esi
call   1050 <lseek@plt>
test   %eax,%eax
js     1356 <main+0x196>
mov    0x8(%rsp),%edi
test   %r12d,%r12d
je     132c <main+0x16c>
call   10b0 <htobe32@plt>
jmp    1331 <main+0x171>
call   1030 <htole32@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1040 <write@plt>
xor    %ebp,%ebp
cmp    $0x4,%eax
je     138c <main+0x1cc>
lea    0xceb(%rip),%rdi
jmp    1382 <main+0x1c2>
lea    0xcc0(%rip),%rdi
jmp    1382 <main+0x1c2>
lea    0xcad(%rip),%rdi
jmp    136f <main+0x1af>
lea    0xca9(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%ebp
jmp    1393 <main+0x1d3>
lea    0xca1(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%ebp
mov    %ebx,%edi
call   1060 <close@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [5 x i8] c"if:b\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [14 x i8] c"missing file\0A\00"
@.str.2 = [5 x i8] c"stat\00"
@O_RDWR = global i32 0
@.str.3 = [5 x i8] c"open\00"
@SEEK_SET = global i32 0
@.str.4 = [6 x i8] c"lseek\00"
@.str.5 = [5 x i8] c"read\00"
@.str.6 = [8 x i8] c"barebox\00"
@.str.7 = [15 x i8] c"invalid magic\0A\00"
@.str.8 = [6 x i8] c"write\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca [8 x i8]
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i8* null, i8** %10
store i32 1, i32* %11
store i32 0, i32* %12
store i32 0, i32* %14
br label %15
15: ; preds = %26, %2
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = call i32 @getopt(i32 %16, i8** %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %18, i32* %7
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %27
20: ; preds = %15
%21 = load i32, i32* %7
switch i32 %21, label %26 [
i32 102, label %22
i32 98, label %24
i32 105, label %25
]
22: ; preds = %20
%23 = load i8*, i8** @optarg
store i8* %23, i8** %10
br label %26
24: ; preds = %20
store i32 1, i32* %12
br label %26
25: ; preds = %20
store i32 1, i32* %14
br label %26
26: ; preds = %20, %25, %24, %22
br label %15
27: ; preds = %15
%28 = load i8*, i8** %10
%29 = icmp ne i8* %28, null
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %106
33: ; preds = %27
%34 = load i8*, i8** %10
%35 = call i64 @stat(i8* %34, %struct.stat* %6)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %106
39: ; preds = %33
%40 = load i8*, i8** %10
%41 = load i32, i32* @O_RDWR
%42 = call i32 @open(i8* %40, i32 %41)
store i32 %42, i32* %8
%43 = load i32, i32* %8
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %39
%46 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %106
47: ; preds = %39
%48 = load i32, i32* %8
%49 = load i32, i32* @SEEK_SET
%50 = call i32 @lseek(i32 %48, i32 32, i32 %49)
store i32 %50, i32* %11
%51 = load i32, i32* %11
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %47
%54 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %11
br label %102
55: ; preds = %47
%56 = load i32, i32* %8
%57 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%58 = call i32 @read(i32 %56, i8* %57, i32 8)
store i32 %58, i32* %11
%59 = load i32, i32* %11
%60 = icmp slt i32 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %55
%62 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %11
br label %102
63: ; preds = %55
%64 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %75
67: ; preds = %63
%68 = load i32, i32* %14
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %71
70: ; preds = %67
store i32 0, i32* %11
br label %74
71: ; preds = %67
%72 = load i32, i32* @stderr
%73 = call i32 @fprintf(i32 %72, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %11
br label %74
74: ; preds = %71, %70
br label %102
75: ; preds = %63
%76 = load i32, i32* %8
%77 = load i32, i32* @SEEK_SET
%78 = call i32 @lseek(i32 %76, i32 44, i32 %77)
store i32 %78, i32* %11
%79 = load i32, i32* %11
%80 = icmp slt i32 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %75
%82 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %11
br label %102
83: ; preds = %75
%84 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%85 = load i32, i32* %84
store i32 %85, i32* %9
%86 = load i32, i32* %12
%87 = icmp ne i32 %86, 0
br i1 %87, label %88, label %91
88: ; preds = %83
%89 = load i32, i32* %9
%90 = call i32 @htobe32(i32 %89)
store i32 %90, i32* %9
br label %94
91: ; preds = %83
%92 = load i32, i32* %9
%93 = call i32 @htole32(i32 %92)
store i32 %93, i32* %9
br label %94
94: ; preds = %91, %88
%95 = load i32, i32* %8
%96 = call i32 @write(i32 %95, i32* %9, i32 4)
store i32 %96, i32* %11
%97 = load i32, i32* %11
%98 = icmp ne i32 %97, 4
br i1 %98, label %99, label %101
99: ; preds = %94
%100 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %11
br label %102
101: ; preds = %94
store i32 0, i32* %11
br label %102
102: ; preds = %101, %99, %81, %74, %61, %53
%103 = load i32, i32* %8
%104 = call i32 @close(i32 %103)
%105 = load i32, i32* %11
store i32 %105, i32* %3
br label %106
106: ; preds = %102, %45, %37, %30
%107 = load i32, i32* %3
ret i32 %107
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [5 x i8] c"if:b\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [14 x i8] c"missing file\0A\00"
@.str.2 = [5 x i8] c"stat\00"
@O_RDWR = global i32 0
@.str.3 = [5 x i8] c"open\00"
@SEEK_SET = global i32 0
@.str.4 = [6 x i8] c"lseek\00"
@.str.5 = [5 x i8] c"read\00"
@.str.6 = [8 x i8] c"barebox\00"
@.str.7 = [15 x i8] c"invalid magic\0A\00"
@.str.8 = [6 x i8] c"write\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.stat
%4 = alloca i32
%5 = alloca [8 x i8]
%6 = bitcast %struct.stat* %3 to i8*
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
br label %9
9: ; preds = %20, %2
%10 = phi i8* [ %21, %20 ], [ null, %2 ]
%11 = phi i32 [ %14, %20 ], [ 0, %2 ]
%12 = phi i32 [ %17, %20 ], [ 0, %2 ]
br label %13
13: ; preds = %18, %9
%14 = phi i32 [ %11, %9 ], [ 1, %18 ]
%15 = phi i32 [ %12, %9 ], [ %17, %18 ]
br label %16
16: ; preds = %18, %13
%17 = phi i32 [ %15, %13 ], [ 1, %18 ]
br label %18
18: ; preds = %16, %18
%19 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %19, label %18 [
i32 -1, label %22
i32 102, label %20
i32 98, label %13
i32 105, label %16
]
20: ; preds = %18
%21 = load i8*, i8** @optarg
br label %9
22: ; preds = %18
%23 = icmp eq i8* %10, null
br i1 %23, label %24, label %27
24: ; preds = %22
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %80
27: ; preds = %22
%28 = call i64 @stat(i8* %10, %struct.stat* %3)
%29 = icmp eq i64 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %80
32: ; preds = %27
%33 = load i32, i32* @O_RDWR
%34 = call i32 @open(i8* %10, i32 %33)
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %80
38: ; preds = %32
%39 = load i32, i32* @SEEK_SET
%40 = call i32 @lseek(i32 %34, i32 32, i32 %39)
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %77
44: ; preds = %38
%45 = call i32 @read(i32 %34, i8* %8, i32 8)
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %77
49: ; preds = %44
%50 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %57, label %52
52: ; preds = %49
%53 = icmp eq i32 %17, 0
br i1 %53, label %54, label %77
54: ; preds = %52
%55 = load i32, i32* @stderr
%56 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %77
57: ; preds = %49
%58 = load i32, i32* @SEEK_SET
%59 = call i32 @lseek(i32 %34, i32 44, i32 %58)
%60 = icmp slt i32 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %77
63: ; preds = %57
%64 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%65 = load i32, i32* %64
%66 = icmp eq i32 %14, 0
br i1 %66, label %69, label %67
67: ; preds = %63
%68 = call i32 @htobe32(i32 %65)
br label %71
69: ; preds = %63
%70 = call i32 @htole32(i32 %65)
br label %71
71: ; preds = %69, %67
%72 = phi i32 [ %70, %69 ], [ %68, %67 ]
store i32 %72, i32* %4
%73 = call i32 @write(i32 %34, i32* %4, i32 4)
%74 = icmp eq i32 %73, 4
br i1 %74, label %77, label %75
75: ; preds = %71
%76 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %77
77: ; preds = %71, %52, %54, %75, %61, %47, %42
%78 = phi i32 [ 1, %42 ], [ 1, %47 ], [ 1, %54 ], [ 1, %61 ], [ 1, %75 ], [ 0, %52 ], [ 0, %71 ]
%79 = call i32 @close(i32 %34)
br label %80
80: ; preds = %77, %36, %30, %24
%81 = phi i32 [ 1, %30 ], [ 1, %36 ], [ %78, %77 ], [ 1, %24 ]
ret i32 %81
}