#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*/ off_t;
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ SEEK_SET;
scalar_t__ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
scalar_t__ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/, int);
size_t optind;
int read(int, unsigned char *, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ usage(char *);
int write(int, unsigned char *, int);
int main(int argc, char **argv) {
  int fd;
  int opt, flags = 0;
  int rc = 0;
  unsigned int *ptr;
  char *file;
  unsigned char buffer[1];
  if (argc < 3) {
    usage(argv[0]);
    exit((2));
  }
  while ((opt = getopt(argc, argv, "id")) != -1) {
    switch (opt) {
    case 'i':
      flags |= (0x0001);
      break;
    case 'd':
      flags |= (0x0002);
      break;
    default:
      usage(argv[0]);
      exit((2));
    }
  }
  if ((flags == 0) || (flags == ((0x0001) | (0x0002)))) {
    fprintf(stderr, "Need to specify -i or -d\n");
    exit((2));
  }
  file = argv[optind];
  if ((fd = open(file, O_RDWR, 0700)) < 0) {
    fprintf(stderr, "Cannot open %s : %s\n", file, strerror(errno));
    exit((2));
  }
  if ((lseek(fd, (off_t)(9), SEEK_SET)) < 0) {
    fprintf(stderr, "Cannot lseek to offset %d in %s : %s\n", (9), file,
            strerror(errno));
    rc = (2);
    goto tidy;
  }
  if (read(fd, buffer, sizeof(buffer)) != sizeof(buffer)) {
    fprintf(stderr, "Failed to read\n");
    rc = (2);
    goto tidy;
  }
  if (flags & (0x0001))
    buffer[0]++;
  if (flags & (0x0002))
    buffer[0]--;
  if ((lseek(fd, (off_t)(9), SEEK_SET)) < 0) {
    fprintf(stderr, "Cannot lseek to offset %d in %s : %s\n", (9), file,
            strerror(errno));
    rc = (2);
    goto tidy;
  }
  if (write(fd, buffer, sizeof(buffer)) != sizeof(buffer)) {
    fprintf(stderr, "Failed to write\n");
    rc = (2);
  }
tidy:
  if (close(fd) < 0) {
    fprintf(stderr, "Close failed: %s\n", strerror(errno));
    exit((2));
  }
  exit(rc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11e4 <main+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
jmp    11e9 <main+0x49>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe09(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     1264 <main+0xc4>
mov    -0x18(%rbp),%eax
mov    %eax,-0x38(%rbp)
sub    $0x64,%eax
je     123b <main+0x9b>
jmp    121c <main+0x7c>
mov    -0x38(%rbp),%eax
sub    $0x69,%eax
jne    1249 <main+0xa9>
jmp    122d <main+0x8d>
mov    -0x1c(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    125f <main+0xbf>
mov    -0x1c(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    125f <main+0xbf>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <usage@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
jmp    11e9 <main+0x49>
cmpl   $0x0,-0x1c(%rbp)
je     1278 <main+0xd8>
cmpl   $0x3,-0x1c(%rbp)
jne    1299 <main+0xf9>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
lea    0xd7b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x2d3c(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    0x2d2e(%rip),%rax
mov    (%rax),%esi
mov    $0x1c0,%edx
call   1090 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1316 <main+0x176>
mov    0x2cf7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cdb(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rdx
mov    %rax,%rcx
lea    0xd18(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    -0x14(%rbp),%edi
mov    0x2ca0(%rip),%rax
mov    (%rax),%edx
mov    $0x9,%esi
call   1040 <lseek@plt>
cmp    $0x0,%rax
jge    1381 <main+0x1e1>
mov    0x2c93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x2c77(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%rcx
mov    %rax,%r8
lea    0xcc9(%rip),%rsi
mov    $0x9,%edx
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x2,-0x20(%rbp)
jmp    149a <main+0x2fa>
mov    -0x14(%rbp),%edi
lea    -0x31(%rbp),%rsi
mov    $0x1,%edx
call   1060 <read@plt>
cltq
cmp    $0x1,%rax
je     13c1 <main+0x221>
mov    0x2c2b(%rip),%rax
mov    (%rax),%edi
lea    0xcaa(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x2,-0x20(%rbp)
jmp    149a <main+0x2fa>
mov    -0x1c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     13d8 <main+0x238>
mov    -0x31(%rbp),%al
add    $0x1,%al
mov    %al,-0x31(%rbp)
mov    -0x1c(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     13ef <main+0x24f>
mov    -0x31(%rbp),%al
add    $0xff,%al
mov    %al,-0x31(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2bc7(%rip),%rax
mov    (%rax),%edx
mov    $0x9,%esi
call   1040 <lseek@plt>
cmp    $0x0,%rax
jge    145a <main+0x2ba>
mov    0x2bba(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    0x2b9e(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%rcx
mov    %rax,%r8
lea    0xbf0(%rip),%rsi
mov    $0x9,%edx
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x2,-0x20(%rbp)
jmp    149a <main+0x2fa>
mov    -0x14(%rbp),%edi
lea    -0x31(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cltq
cmp    $0x1,%rax
je     1495 <main+0x2f5>
mov    0x2b52(%rip),%rax
mov    (%rax),%edi
lea    0xbe1(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x2,-0x20(%rbp)
jmp    149a <main+0x2fa>
mov    -0x14(%rbp),%edi
call   1050 <close@plt>
cmp    $0x0,%rax
jge    14e4 <main+0x344>
mov    0x2b1d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    0x2b09(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x68(%rbp),%edi
mov    %rax,%rdx
lea    0xba6(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    -0x20(%rbp),%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
cmp    $0x3,%edi
jl     1212 <main+0x72>
mov    %edi,%ebp
xor    %ebx,%ebx
lea    0xe46(%rip),%r14
jmp    11c7 <main+0x27>
nopl   0x0(%rax)
mov    $0x2,%ecx
or     %ecx,%ebx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   10a0 <getopt@plt>
cmp    $0x64,%eax
je     11c0 <main+0x20>
mov    $0x1,%ecx
cmp    $0x69,%eax
je     11c5 <main+0x25>
cmp    $0xffffffff,%eax
jne    1212 <main+0x72>
cmp    $0x3,%ebx
je     11f1 <main+0x51>
test   %ebx,%ebx
jne    1224 <main+0x84>
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
lea    0xe02(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    (%r15),%rdi
call   1080 <usage@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    0x2db5(%rip),%rax
mov    (%rax),%rax
mov    (%r15,%rax,8),%r15
mov    0x2daf(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
mov    $0x1c0,%edx
call   1090 <open@plt>
test   %eax,%eax
jns    1283 <main+0xe3>
mov    0x2d7d(%rip),%rax
mov    (%rax),%ebp
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xdb3(%rip),%rsi
mov    %ebp,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    %eax,%ebp
mov    0x2d34(%rip),%r14
mov    (%r14),%edx
mov    %eax,%edi
mov    $0x9,%esi
call   1040 <lseek@plt>
test   %rax,%rax
jns    12d6 <main+0x136>
mov    0x2d29(%rip),%rax
mov    (%rax),%r14d
mov    0x2d17(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd73(%rip),%rsi
mov    %r14d,%edi
mov    $0x9,%edx
mov    %r15,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1355 <main+0x1b5>
lea    0x7(%rsp),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1060 <read@plt>
cmp    $0x1,%eax
jne    133e <main+0x19e>
test   $0x1,%bl
je     12f6 <main+0x156>
addb   $0x1,0x7(%rsp)
test   $0x2,%bl
je     1300 <main+0x160>
addb   $0xff,0x7(%rsp)
mov    (%r14),%edx
mov    %ebp,%edi
mov    $0x9,%esi
call   1040 <lseek@plt>
test   %rax,%rax
js     12a0 <main+0x100>
lea    0x7(%rsp),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1030 <write@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
je     135a <main+0x1ba>
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
lea    0xd2c(%rip),%rsi
jmp    134e <main+0x1ae>
mov    0x2c8b(%rip),%rax
mov    (%rax),%edi
lea    0xd0a(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%ebx
mov    %ebp,%edi
call   1050 <close@plt>
test   %rax,%rax
jns    139a <main+0x1fa>
mov    0x2c63(%rip),%rax
mov    (%rax),%ebx
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xcf5(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
mov    %ebx,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"id\00"
@stderr = global i32 0
@.str.1 = [26 x i8] c"Need to specify -i or -d\0A\00"
@optind = global i64 0
@O_RDWR = global i32 0
@.str.2 = [21 x i8] c"Cannot open %s : %s\0A\00"
@errno = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [38 x i8] c"Cannot lseek to offset %d in %s : %s\0A\00"
@.str.4 = [16 x i8] c"Failed to read\0A\00"
@.str.5 = [17 x i8] c"Failed to write\0A\00"
@.str.6 = [18 x i8] c"Close failed: %s\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 i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca [1 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @usage(i8* %18)
%20 = call i32 @exit(i32 2)
unreachable
21: ; preds = %2
br label %22
22: ; preds = %41, %21
%23 = load i32, i32* %4
%24 = load i8**, i8*** %5
%25 = call i32 @getopt(i32 %23, i8** %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %25, i32* %7
%26 = icmp ne i32 %25, -1
br i1 %26, label %27, label %42
27: ; preds = %22
%28 = load i32, i32* %7
switch i32 %28, label %35 [
i32 105, label %29
i32 100, label %32
]
29: ; preds = %27
%30 = load i32, i32* %8
%31 = or i32 %30, 1
store i32 %31, i32* %8
br label %41
32: ; preds = %27
%33 = load i32, i32* %8
%34 = or i32 %33, 2
store i32 %34, i32* %8
br label %41
35: ; preds = %27
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 0
%38 = load i8*, i8** %37
%39 = call i32 @usage(i8* %38)
%40 = call i32 @exit(i32 2)
unreachable
41: ; preds = %32, %29
br label %22
42: ; preds = %22
%43 = load i32, i32* %8
%44 = icmp eq i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = load i32, i32* %8
%47 = icmp eq i32 %46, 3
br i1 %47, label %48, label %52
48: ; preds = %45, %42
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%51 = call i32 @exit(i32 2)
unreachable
52: ; preds = %45
%53 = load i8**, i8*** %5
%54 = load i64, i64* @optind
%55 = getelementptr inbounds i8*, i8** %53, i64 %54
%56 = load i8*, i8** %55
store i8* %56, i8** %11
%57 = load i8*, i8** %11
%58 = load i32, i32* @O_RDWR
%59 = call i32 @open(i8* %57, i32 %58, i32 448)
store i32 %59, i32* %6
%60 = icmp slt i32 %59, 0
br i1 %60, label %61, label %68
61: ; preds = %52
%62 = load i32, i32* @stderr
%63 = load i8*, i8** %11
%64 = load i32, i32* @errno
%65 = call i8* @strerror(i32 %64)
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %63, i8* %65)
%67 = call i32 @exit(i32 2)
unreachable
68: ; preds = %52
%69 = load i32, i32* %6
%70 = load i32, i32* @SEEK_SET
%71 = call i64 @lseek(i32 %69, i32 9, i32 %70)
%72 = icmp slt i64 %71, 0
br i1 %72, label %73, label %79
73: ; preds = %68
%74 = load i32, i32* @stderr
%75 = load i8*, i8** %11
%76 = load i32, i32* @errno
%77 = call i8* @strerror(i32 %76)
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 9, i8* %75, i8* %77)
store i32 2, i32* %9
br label %125
79: ; preds = %68
%80 = load i32, i32* %6
%81 = getelementptr inbounds [1 x i8], [1 x i8]* %12, i64 0, i64 0
%82 = call i32 @read(i32 %80, i8* %81, i32 1)
%83 = sext i32 %82 to i64
%84 = icmp ne i64 %83, 1
br i1 %84, label %85, label %88
85: ; preds = %79
%86 = load i32, i32* @stderr
%87 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
store i32 2, i32* %9
br label %125
88: ; preds = %79
%89 = load i32, i32* %8
%90 = and i32 %89, 1
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %96
92: ; preds = %88
%93 = getelementptr inbounds [1 x i8], [1 x i8]* %12, i64 0, i64 0
%94 = load i8, i8* %93
%95 = add i8 %94, 1
store i8 %95, i8* %93
br label %96
96: ; preds = %92, %88
%97 = load i32, i32* %8
%98 = and i32 %97, 2
%99 = icmp ne i32 %98, 0
br i1 %99, label %100, label %104
100: ; preds = %96
%101 = getelementptr inbounds [1 x i8], [1 x i8]* %12, i64 0, i64 0
%102 = load i8, i8* %101
%103 = add i8 %102, -1
store i8 %103, i8* %101
br label %104
104: ; preds = %100, %96
%105 = load i32, i32* %6
%106 = load i32, i32* @SEEK_SET
%107 = call i64 @lseek(i32 %105, i32 9, i32 %106)
%108 = icmp slt i64 %107, 0
br i1 %108, label %109, label %115
109: ; preds = %104
%110 = load i32, i32* @stderr
%111 = load i8*, i8** %11
%112 = load i32, i32* @errno
%113 = call i8* @strerror(i32 %112)
%114 = call i32 (i32, i8*, ...) @fprintf(i32 %110, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 9, i8* %111, i8* %113)
store i32 2, i32* %9
br label %125
115: ; preds = %104
%116 = load i32, i32* %6
%117 = getelementptr inbounds [1 x i8], [1 x i8]* %12, i64 0, i64 0
%118 = call i32 @write(i32 %116, i8* %117, i32 1)
%119 = sext i32 %118 to i64
%120 = icmp ne i64 %119, 1
br i1 %120, label %121, label %124
121: ; preds = %115
%122 = load i32, i32* @stderr
%123 = call i32 (i32, i8*, ...) @fprintf(i32 %122, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
store i32 2, i32* %9
br label %124
124: ; preds = %121, %115
br label %125
125: ; preds = %124, %109, %85, %73
%126 = load i32, i32* %6
%127 = call i64 @close(i32 %126)
%128 = icmp slt i64 %127, 0
br i1 %128, label %129, label %135
129: ; preds = %125
%130 = load i32, i32* @stderr
%131 = load i32, i32* @errno
%132 = call i8* @strerror(i32 %131)
%133 = call i32 (i32, i8*, ...) @fprintf(i32 %130, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %132)
%134 = call i32 @exit(i32 2)
unreachable
135: ; preds = %125
%136 = load i32, i32* %9
%137 = call i32 @exit(i32 %136)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"id\00"
@stderr = global i32 0
@.str.1 = [26 x i8] c"Need to specify -i or -d\0A\00"
@optind = global i64 0
@O_RDWR = global i32 0
@.str.2 = [21 x i8] c"Cannot open %s : %s\0A\00"
@errno = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [38 x i8] c"Cannot lseek to offset %d in %s : %s\0A\00"
@.str.4 = [16 x i8] c"Failed to read\0A\00"
@.str.5 = [17 x i8] c"Failed to write\0A\00"
@.str.6 = [18 x i8] c"Close failed: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [1 x i8]
%4 = getelementptr inbounds [1 x i8], [1 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @usage(i8* %7)
%9 = tail call i32 @exit(i32 2)
unreachable
10: ; preds = %2, %18
%11 = phi i32 [ %20, %18 ], [ 0, %2 ]
%12 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %12, label %14 [
i32 -1, label %21
i32 105, label %18
i32 100, label %13
]
13: ; preds = %10
br label %18
14: ; preds = %10
%15 = load i8*, i8** %1
%16 = tail call i32 @usage(i8* %15)
%17 = tail call i32 @exit(i32 2)
unreachable
18: ; preds = %10, %13
%19 = phi i32 [ 2, %13 ], [ 1, %10 ]
%20 = or i32 %11, %19
br label %10
21: ; preds = %10
switch i32 %11, label %26 [
i32 3, label %22
i32 0, label %22
]
22: ; preds = %21, %21
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%25 = tail call i32 @exit(i32 2)
unreachable
26: ; preds = %21
%27 = load i64, i64* @optind
%28 = getelementptr inbounds i8*, i8** %1, i64 %27
%29 = load i8*, i8** %28
%30 = load i32, i32* @O_RDWR
%31 = tail call i32 @open(i8* %29, i32 %30, i32 448)
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %26
%34 = load i32, i32* @stderr
%35 = load i32, i32* @errno
%36 = tail call i8* @strerror(i32 %35)
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %29, i8* %36)
%38 = tail call i32 @exit(i32 2)
unreachable
39: ; preds = %26
%40 = load i32, i32* @SEEK_SET
%41 = tail call i64 @lseek(i32 %31, i32 9, i32 %40)
%42 = icmp slt i64 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %39
%44 = load i32, i32* @stderr
%45 = load i32, i32* @errno
%46 = tail call i8* @strerror(i32 %45)
%47 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 9, i8* %29, i8* %46)
br label %81
48: ; preds = %39
%49 = call i32 @read(i32 %31, i8* %4, i32 1)
%50 = icmp eq i32 %49, 1
br i1 %50, label %54, label %51
51: ; preds = %48
%52 = load i32, i32* @stderr
%53 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %81
54: ; preds = %48
%55 = and i32 %11, 1
%56 = icmp eq i32 %55, 0
br i1 %56, label %60, label %57
57: ; preds = %54
%58 = load i8, i8* %4
%59 = add i8 %58, 1
store i8 %59, i8* %4
br label %60
60: ; preds = %57, %54
%61 = and i32 %11, 2
%62 = icmp eq i32 %61, 0
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = load i8, i8* %4
%65 = add i8 %64, -1
store i8 %65, i8* %4
br label %66
66: ; preds = %63, %60
%67 = load i32, i32* @SEEK_SET
%68 = tail call i64 @lseek(i32 %31, i32 9, i32 %67)
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %75
70: ; preds = %66
%71 = load i32, i32* @stderr
%72 = load i32, i32* @errno
%73 = tail call i8* @strerror(i32 %72)
%74 = tail call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 9, i8* %29, i8* %73)
br label %81
75: ; preds = %66
%76 = call i32 @write(i32 %31, i8* %4, i32 1)
%77 = icmp eq i32 %76, 1
br i1 %77, label %81, label %78
78: ; preds = %75
%79 = load i32, i32* @stderr
%80 = tail call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %81
81: ; preds = %75, %78, %70, %51, %43
%82 = phi i32 [ 2, %43 ], [ 2, %51 ], [ 2, %70 ], [ 2, %78 ], [ 0, %75 ]
%83 = tail call i64 @close(i32 %31)
%84 = icmp slt i64 %83, 0
br i1 %84, label %85, label %91
85: ; preds = %81
%86 = load i32, i32* @stderr
%87 = load i32, i32* @errno
%88 = tail call i8* @strerror(i32 %87)
%89 = tail call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %88)
%90 = tail call i32 @exit(i32 2)
unreachable
91: ; preds = %81
%92 = tail call i32 @exit(i32 %82)
unreachable
}