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

/* Variables and functions */
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ SEEK_SET;
scalar_t__ close(int);
int open(char *, int, ...);
int /*<<< orphan*/ print(char *);
int read(int, unsigned char *, int);
int /*<<< orphan*/ seek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int write(int, unsigned char *, int);
int main() {
  unsigned char buffer[1024], buffer2[1024];
  int i = 0;
  int fd = 0;
  for (i = 0; i < 1024; i++)
    buffer[i] = i;
  fd = open("foo.bin", O_RDWR, 0);
  if (fd != -1)
    return (1);
  close(fd);
  print("'Open' of non existing file: Passed\n");
  fd = open("foo.bin", O_RDWR | O_TRUNC, 0);
  if (fd == -1)
    return (2);
  if (fd >= 0 && fd <= 2)
    return (3);
  print("Open file: Passed\n");
  if (write(fd, buffer, 1024) != 1024)
    return (4);
  print("Write file: Passed\n");
  seek(fd, SEEK_SET, 0);
  if (read(fd, buffer2, 1024) != 1024)
    return (5);
  for (i = 0; i < 1024; i++) {
    if (buffer[i] != buffer2[i])
      return (6);
  }
  print("Read: Passed\n");
  if (close(fd) != 0)
    return (7);
  print("close: Passed\n");
  fd = open("foo.bin", O_RDWR);
  if (fd < 2)
    return (8);
  print("Open of an existing file: Passed\n");
  if (read(fd, buffer2, 1024) != 1024)
    return (9);
  for (i = 0; i < 1024; i++) {
    if (buffer[i] != buffer2[i])
      return (10);
  }
  print("Read data corectness: Passed\n");
  if (close(fd))
    return (11);
  print("close: passed\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x814(%rbp)
movl   $0x0,-0x818(%rbp)
movl   $0x0,-0x814(%rbp)
cmpl   $0x400,-0x814(%rbp)
jge    11ca <main+0x6a>
mov    -0x814(%rbp),%eax
mov    %al,%cl
movslq -0x814(%rbp),%rax
mov    %cl,-0x410(%rbp,%rax,1)
mov    -0x814(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x814(%rbp)
jmp    1190 <main+0x30>
mov    0x2e0f(%rip),%rax
mov    (%rax),%esi
lea    0xe26(%rip),%rdi
xor    %edx,%edx
mov    $0x0,%al
call   1070 <open@plt>
mov    %eax,-0x818(%rbp)
cmpl   $0xffffffff,-0x818(%rbp)
je     1202 <main+0xa2>
movl   $0x1,-0x4(%rbp)
jmp    14bd <main+0x35d>
mov    -0x818(%rbp),%edi
call   1040 <close@plt>
lea    0xdf4(%rip),%rdi
call   1050 <print@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%esi
mov    0x2dcf(%rip),%rax
or     (%rax),%esi
lea    0xdce(%rip),%rdi
xor    %edx,%edx
mov    $0x0,%al
call   1070 <open@plt>
mov    %eax,-0x818(%rbp)
cmpl   $0xffffffff,-0x818(%rbp)
jne    125a <main+0xfa>
movl   $0x2,-0x4(%rbp)
jmp    14bd <main+0x35d>
cmpl   $0x0,-0x818(%rbp)
jl     1280 <main+0x120>
cmpl   $0x2,-0x818(%rbp)
jg     1280 <main+0x120>
movl   $0x3,-0x4(%rbp)
jmp    14bd <main+0x35d>
lea    0xda6(%rip),%rdi
call   1050 <print@plt>
mov    -0x818(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
call   1030 <write@plt>
cmp    $0x400,%eax
je     12ba <main+0x15a>
movl   $0x4,-0x4(%rbp)
jmp    14bd <main+0x35d>
lea    0xd7f(%rip),%rdi
call   1050 <print@plt>
mov    -0x818(%rbp),%edi
mov    0x2cfd(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1080 <seek@plt>
mov    -0x818(%rbp),%edi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
cmp    $0x400,%eax
je     130a <main+0x1aa>
movl   $0x5,-0x4(%rbp)
jmp    14bd <main+0x35d>
movl   $0x0,-0x814(%rbp)
cmpl   $0x400,-0x814(%rbp)
jge    136f <main+0x20f>
movslq -0x814(%rbp),%rax
movzbl -0x410(%rbp,%rax,1),%eax
ff
movslq -0x814(%rbp),%rcx
movzbl -0x810(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     1356 <main+0x1f6>
movl   $0x6,-0x4(%rbp)
jmp    14bd <main+0x35d>
jmp    135b <main+0x1fb>
mov    -0x814(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x814(%rbp)
jmp    1314 <main+0x1b4>
lea    0xcde(%rip),%rdi
call   1050 <print@plt>
mov    -0x818(%rbp),%edi
call   1040 <close@plt>
cmp    $0x0,%rax
je     139c <main+0x23c>
movl   $0x7,-0x4(%rbp)
jmp    14bd <main+0x35d>
lea    0xcbf(%rip),%rdi
call   1050 <print@plt>
mov    0x2c31(%rip),%rax
mov    (%rax),%esi
lea    0xc48(%rip),%rdi
mov    $0x0,%al
call   1070 <open@plt>
mov    %eax,-0x818(%rbp)
cmpl   $0x2,-0x818(%rbp)
jge    13de <main+0x27e>
movl   $0x8,-0x4(%rbp)
jmp    14bd <main+0x35d>
lea    0xc8c(%rip),%rdi
call   1050 <print@plt>
mov    -0x818(%rbp),%edi
lea    -0x810(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
cmp    $0x400,%eax
je     1418 <main+0x2b8>
movl   $0x9,-0x4(%rbp)
jmp    14bd <main+0x35d>
movl   $0x0,-0x814(%rbp)
cmpl   $0x400,-0x814(%rbp)
jge    147d <main+0x31d>
movslq -0x814(%rbp),%rax
movzbl -0x410(%rbp,%rax,1),%eax
ff
movslq -0x814(%rbp),%rcx
movzbl -0x810(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     1464 <main+0x304>
movl   $0xa,-0x4(%rbp)
jmp    14bd <main+0x35d>
jmp    1469 <main+0x309>
mov    -0x814(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x814(%rbp)
jmp    1422 <main+0x2c2>
lea    0xc0f(%rip),%rdi
call   1050 <print@plt>
mov    -0x818(%rbp),%edi
call   1040 <close@plt>
cmp    $0x0,%rax
je     14aa <main+0x34a>
movl   $0xb,-0x4(%rbp)
jmp    14bd <main+0x35d>
lea    0xc00(%rip),%rdi
call   1050 <print@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x808,%rsp
movdqa 0xe8e(%rip),%xmm2
xor    %eax,%eax
movdqa 0xe93(%rip),%xmm8
movdqa 0xe9a(%rip),%xmm9
movdqa 0xea2(%rip),%xmm3
movdqa 0xeaa(%rip),%xmm4
movdqa 0xeb2(%rip),%xmm5
movdqa 0xeba(%rip),%xmm6
movdqa 0xec2(%rip),%xmm7
movdqa 0xeca(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
movdqa %xmm2,(%rsp,%rax,1)
movdqa %xmm2,%xmm0
paddb  %xmm8,%xmm0
movdqa %xmm0,0x10(%rsp,%rax,1)
movdqa %xmm2,%xmm0
paddb  %xmm9,%xmm0
movdqa %xmm0,0x20(%rsp,%rax,1)
movdqa %xmm2,%xmm0
paddb  %xmm3,%xmm0
movdqa %xmm0,0x30(%rsp,%rax,1)
movdqa %xmm2,%xmm0
paddb  %xmm4,%xmm0
movdqa %xmm0,0x40(%rsp,%rax,1)
movdqa %xmm2,%xmm0
paddb  %xmm5,%xmm0
movdqa %xmm0,0x50(%rsp,%rax,1)
movdqa %xmm2,%xmm0
paddb  %xmm6,%xmm0
movdqa %xmm0,0x60(%rsp,%rax,1)
movdqa %xmm2,%xmm0
paddb  %xmm7,%xmm0
movdqa %xmm0,0x70(%rsp,%rax,1)
sub    $0xffffffffffffff80,%rax
pxor   %xmm1,%xmm2
cmp    $0x400,%rax
jne    11c0 <main+0x60>
mov    0x2da0(%rip),%r14
mov    (%r14),%esi
lea    0xe46(%rip),%rdi
xor    %edx,%edx
xor    %eax,%eax
call   1070 <open@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0xffffffff,%ecx
je     126a <main+0x10a>
add    $0x808,%rsp
pop    %rbx
pop    %r14
ret
mov    $0xffffffff,%edi
call   1040 <close@plt>
lea    0xe1d(%rip),%rdi
call   1050 <print@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%esi
or     (%r14),%esi
lea    0xdfd(%rip),%rdi
xor    %edx,%edx
xor    %eax,%eax
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     1491 <main+0x331>
mov    %eax,%ebx
mov    $0x3,%eax
cmp    $0x3,%ebx
jb     125f <main+0xff>
lea    0xe05(%rip),%rdi
call   1050 <print@plt>
mov    %rsp,%rsi
mov    %ebx,%edi
mov    $0x400,%edx
call   1030 <write@plt>
mov    %eax,%ecx
mov    $0x4,%eax
cmp    $0x400,%ecx
jne    125f <main+0xff>
lea    0xdee(%rip),%rdi
call   1050 <print@plt>
mov    0x2ce2(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1080 <seek@plt>
lea    0x400(%rsp),%rsi
mov    %ebx,%edi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %eax,%ecx
mov    $0x5,%eax
cmp    $0x400,%ecx
jne    125f <main+0xff>
xor    %ecx,%ecx
mov    $0x6,%eax
movzbl (%rsp,%rcx,1),%edx
cmp    0x400(%rsp,%rcx,1),%dl
jne    125f <main+0xff>
movzbl 0x1(%rsp,%rcx,1),%edx
cmp    0x401(%rsp,%rcx,1),%dl
jne    125f <main+0xff>
movzbl 0x2(%rsp,%rcx,1),%edx
cmp    0x402(%rsp,%rcx,1),%dl
jne    125f <main+0xff>
movzbl 0x3(%rsp,%rcx,1),%edx
cmp    0x403(%rsp,%rcx,1),%dl
jne    125f <main+0xff>
add    $0x4,%rcx
cmp    $0x400,%rcx
jne    1327 <main+0x1c7>
lea    0xd62(%rip),%rdi
call   1050 <print@plt>
mov    %ebx,%edi
call   1040 <close@plt>
mov    %rax,%rcx
mov    $0x7,%eax
test   %rcx,%rcx
jne    125f <main+0xff>
lea    0xd4c(%rip),%rdi
call   1050 <print@plt>
mov    (%r14),%esi
lea    0xcdb(%rip),%rdi
xor    %eax,%eax
call   1070 <open@plt>
mov    %eax,%ebx
mov    $0x8,%eax
cmp    $0x2,%ebx
jl     125f <main+0xff>
lea    0xd2e(%rip),%rdi
call   1050 <print@plt>
lea    0x400(%rsp),%rsi
mov    %ebx,%edi
mov    $0x400,%edx
call   1060 <read@plt>
mov    %eax,%ecx
mov    $0x9,%eax
cmp    $0x400,%ecx
jne    125f <main+0xff>
xor    %ecx,%ecx
mov    $0xa,%eax
movzbl (%rsp,%rcx,1),%edx
cmp    0x400(%rsp,%rcx,1),%dl
jne    125f <main+0xff>
movzbl 0x1(%rsp,%rcx,1),%edx
cmp    0x401(%rsp,%rcx,1),%dl
jne    125f <main+0xff>
movzbl 0x2(%rsp,%rcx,1),%edx
cmp    0x402(%rsp,%rcx,1),%dl
jne    125f <main+0xff>
movzbl 0x3(%rsp,%rcx,1),%edx
cmp    0x403(%rsp,%rcx,1),%dl
jne    125f <main+0xff>
add    $0x4,%rcx
cmp    $0x400,%rcx
jne    1406 <main+0x2a6>
lea    0xcc2(%rip),%rdi
call   1050 <print@plt>
mov    %ebx,%edi
call   1040 <close@plt>
mov    %rax,%rcx
mov    $0xb,%eax
test   %rcx,%rcx
jne    125f <main+0xff>
lea    0xcbc(%rip),%rdi
call   1050 <print@plt>
xor    %eax,%eax
jmp    125f <main+0xff>
mov    $0x2,%eax
jmp    125f <main+0xff>

LLVM IR (-O0):
@.str = [8 x i8] c"foo.bin\00"
@O_RDWR = global i32 0
@.str.1 = [37 x i8] c"'Open' of non existing file: Passed\0A\00"
@O_TRUNC = global i32 0
@.str.2 = [19 x i8] c"Open file: Passed\0A\00"
@.str.3 = [20 x i8] c"Write file: Passed\0A\00"
@SEEK_SET = global i32 0
@.str.4 = [14 x i8] c"Read: Passed\0A\00"
@.str.5 = [15 x i8] c"close: Passed\0A\00"
@.str.6 = [34 x i8] c"Open of an existing file: Passed\0A\00"
@.str.7 = [30 x i8] c"Read data corectness: Passed\0A\00"
@.str.8 = [15 x i8] c"close: passed\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %4
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 1024
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load i32, i32* %4
%11 = trunc i32 %10 to i8
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %13
store i8 %11, i8* %14
br label %15
15: ; preds = %9
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %6
18: ; preds = %6
%19 = load i32, i32* @O_RDWR
%20 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %19, i32 0)
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = icmp ne i32 %21, -1
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 1, i32* %1
br label %129
24: ; preds = %18
%25 = load i32, i32* %5
%26 = call i64 @close(i32 %25)
%27 = call i32 @print(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%28 = load i32, i32* @O_RDWR
%29 = load i32, i32* @O_TRUNC
%30 = or i32 %28, %29
%31 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %30, i32 0)
store i32 %31, i32* %5
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %35
34: ; preds = %24
store i32 2, i32* %1
br label %129
35: ; preds = %24
%36 = load i32, i32* %5
%37 = icmp sge i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = load i32, i32* %5
%40 = icmp sle i32 %39, 2
br i1 %40, label %41, label %42
41: ; preds = %38
store i32 3, i32* %1
br label %129
42: ; preds = %38, %35
%43 = call i32 @print(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%44 = load i32, i32* %5
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%46 = call i32 @write(i32 %44, i8* %45, i32 1024)
%47 = icmp ne i32 %46, 1024
br i1 %47, label %48, label %49
48: ; preds = %42
store i32 4, i32* %1
br label %129
49: ; preds = %42
%50 = call i32 @print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%51 = load i32, i32* %5
%52 = load i32, i32* @SEEK_SET
%53 = call i32 @seek(i32 %51, i32 %52, i32 0)
%54 = load i32, i32* %5
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%56 = call i32 @read(i32 %54, i8* %55, i32 1024)
%57 = icmp ne i32 %56, 1024
br i1 %57, label %58, label %59
58: ; preds = %49
store i32 5, i32* %1
br label %129
59: ; preds = %49
store i32 0, i32* %4
br label %60
60: ; preds = %77, %59
%61 = load i32, i32* %4
%62 = icmp slt i32 %61, 1024
br i1 %62, label %63, label %80
63: ; preds = %60
%64 = load i32, i32* %4
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %65
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = load i32, i32* %4
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = icmp ne i32 %68, %73
br i1 %74, label %75, label %76
75: ; preds = %63
store i32 6, i32* %1
br label %129
76: ; preds = %63
br label %77
77: ; preds = %76
%78 = load i32, i32* %4
%79 = add nsw i32 %78, 1
store i32 %79, i32* %4
br label %60
80: ; preds = %60
%81 = call i32 @print(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%82 = load i32, i32* %5
%83 = call i64 @close(i32 %82)
%84 = icmp ne i64 %83, 0
br i1 %84, label %85, label %86
85: ; preds = %80
store i32 7, i32* %1
br label %129
86: ; preds = %80
%87 = call i32 @print(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%88 = load i32, i32* @O_RDWR
%89 = call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %88)
store i32 %89, i32* %5
%90 = load i32, i32* %5
%91 = icmp slt i32 %90, 2
br i1 %91, label %92, label %93
92: ; preds = %86
store i32 8, i32* %1
br label %129
93: ; preds = %86
%94 = call i32 @print(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%95 = load i32, i32* %5
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%97 = call i32 @read(i32 %95, i8* %96, i32 1024)
%98 = icmp ne i32 %97, 1024
br i1 %98, label %99, label %100
99: ; preds = %93
store i32 9, i32* %1
br label %129
100: ; preds = %93
store i32 0, i32* %4
br label %101
101: ; preds = %118, %100
%102 = load i32, i32* %4
%103 = icmp slt i32 %102, 1024
br i1 %103, label %104, label %121
104: ; preds = %101
%105 = load i32, i32* %4
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %106
%108 = load i8, i8* %107
%109 = zext i8 %108 to i32
%110 = load i32, i32* %4
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %111
%113 = load i8, i8* %112
%114 = zext i8 %113 to i32
%115 = icmp ne i32 %109, %114
br i1 %115, label %116, label %117
116: ; preds = %104
store i32 10, i32* %1
br label %129
117: ; preds = %104
br label %118
118: ; preds = %117
%119 = load i32, i32* %4
%120 = add nsw i32 %119, 1
store i32 %120, i32* %4
br label %101
121: ; preds = %101
%122 = call i32 @print(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%123 = load i32, i32* %5
%124 = call i64 @close(i32 %123)
%125 = icmp ne i64 %124, 0
br i1 %125, label %126, label %127
126: ; preds = %121
store i32 11, i32* %1
br label %129
127: ; preds = %121
%128 = call i32 @print(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %1
br label %129
129: ; preds = %127, %126, %116, %99, %92, %85, %75, %58, %48, %41, %34, %23
%130 = load i32, i32* %1
ret i32 %130
}

LLVM IR (-O2):
@.str = [8 x i8] c"foo.bin\00"
@O_RDWR = global i32 0
@.str.1 = [37 x i8] c"'Open' of non existing file: Passed\0A\00"
@O_TRUNC = global i32 0
@.str.2 = [19 x i8] c"Open file: Passed\0A\00"
@.str.3 = [20 x i8] c"Write file: Passed\0A\00"
@SEEK_SET = global i32 0
@.str.4 = [14 x i8] c"Read: Passed\0A\00"
@.str.5 = [15 x i8] c"close: Passed\0A\00"
@.str.6 = [34 x i8] c"Open of an existing file: Passed\0A\00"
@.str.7 = [30 x i8] c"Read data corectness: Passed\0A\00"
@.str.8 = [15 x i8] c"close: passed\0A\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %5, %0
%6 = phi i64 [ 0, %0 ], [ %38, %5 ]
%7 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %0 ], [ %39, %5 ]
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %6
%9 = bitcast i8* %8 to <16 x i8>*
store <16 x i8> %7, <16 x i8>* %9
%10 = or i64 %6, 16
%11 = add <16 x i8> %7, <i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16, i8 16>
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %10
%13 = bitcast i8* %12 to <16 x i8>*
store <16 x i8> %11, <16 x i8>* %13
%14 = or i64 %6, 32
%15 = add <16 x i8> %7, <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %14
%17 = bitcast i8* %16 to <16 x i8>*
store <16 x i8> %15, <16 x i8>* %17
%18 = or i64 %6, 48
%19 = add <16 x i8> %7, <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %18
%21 = bitcast i8* %20 to <16 x i8>*
store <16 x i8> %19, <16 x i8>* %21
%22 = or i64 %6, 64
%23 = add <16 x i8> %7, <i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64>
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %22
%25 = bitcast i8* %24 to <16 x i8>*
store <16 x i8> %23, <16 x i8>* %25
%26 = or i64 %6, 80
%27 = add <16 x i8> %7, <i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80, i8 80>
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %26
%29 = bitcast i8* %28 to <16 x i8>*
store <16 x i8> %27, <16 x i8>* %29
%30 = or i64 %6, 96
%31 = add <16 x i8> %7, <i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96, i8 96>
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %30
%33 = bitcast i8* %32 to <16 x i8>*
store <16 x i8> %31, <16 x i8>* %33
%34 = or i64 %6, 112
%35 = add <16 x i8> %7, <i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112, i8 112>
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %34
%37 = bitcast i8* %36 to <16 x i8>*
store <16 x i8> %35, <16 x i8>* %37
%38 = add nuw nsw i64 %6, 128
%39 = xor <16 x i8> %7, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
%40 = icmp eq i64 %38, 1024
br i1 %40, label %41, label %5
41: ; preds = %5
%42 = load i32, i32* @O_RDWR
%43 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %42, i32 0)
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %146
45: ; preds = %41
%46 = tail call i64 @close(i32 -1)
%47 = tail call i32 @print(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%48 = load i32, i32* @O_RDWR
%49 = load i32, i32* @O_TRUNC
%50 = or i32 %49, %48
%51 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %50, i32 0)
%52 = icmp eq i32 %51, -1
br i1 %52, label %146, label %53
53: ; preds = %45
%54 = icmp ult i32 %51, 3
br i1 %54, label %146, label %55
55: ; preds = %53
%56 = tail call i32 @print(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%57 = call i32 @write(i32 %51, i8* %3, i32 1024)
%58 = icmp eq i32 %57, 1024
br i1 %58, label %59, label %146
59: ; preds = %55
%60 = tail call i32 @print(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%61 = load i32, i32* @SEEK_SET
%62 = tail call i32 @seek(i32 %51, i32 %61, i32 0)
%63 = call i32 @read(i32 %51, i8* %4, i32 1024)
%64 = icmp eq i32 %63, 1024
br i1 %64, label %89, label %146
65: ; preds = %89
%66 = or i64 %90, 1
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %66
%68 = load i8, i8* %67
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %66
%70 = load i8, i8* %69
%71 = icmp eq i8 %68, %70
br i1 %71, label %72, label %146
72: ; preds = %65
%73 = or i64 %90, 2
%74 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %73
%77 = load i8, i8* %76
%78 = icmp eq i8 %75, %77
br i1 %78, label %79, label %146
79: ; preds = %72
%80 = or i64 %90, 3
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %80
%82 = load i8, i8* %81
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %80
%84 = load i8, i8* %83
%85 = icmp eq i8 %82, %84
br i1 %85, label %86, label %146
86: ; preds = %79
%87 = add nuw nsw i64 %90, 4
%88 = icmp eq i64 %87, 1024
br i1 %88, label %96, label %89
89: ; preds = %59, %86
%90 = phi i64 [ %87, %86 ], [ 0, %59 ]
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %90
%92 = load i8, i8* %91
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %90
%94 = load i8, i8* %93
%95 = icmp eq i8 %92, %94
br i1 %95, label %65, label %146
96: ; preds = %86
%97 = tail call i32 @print(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%98 = tail call i64 @close(i32 %51)
%99 = icmp eq i64 %98, 0
br i1 %99, label %100, label %146
100: ; preds = %96
%101 = tail call i32 @print(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%102 = load i32, i32* @O_RDWR
%103 = tail call i32 (i8*, i32, ...) @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %102)
%104 = icmp slt i32 %103, 2
br i1 %104, label %146, label %105
105: ; preds = %100
%106 = tail call i32 @print(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%107 = call i32 @read(i32 %103, i8* %4, i32 1024)
%108 = icmp eq i32 %107, 1024
br i1 %108, label %133, label %146
109: ; preds = %133
%110 = or i64 %134, 1
%111 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %110
%112 = load i8, i8* %111
%113 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %110
%114 = load i8, i8* %113
%115 = icmp eq i8 %112, %114
br i1 %115, label %116, label %146
116: ; preds = %109
%117 = or i64 %134, 2
%118 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %117
%119 = load i8, i8* %118
%120 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %117
%121 = load i8, i8* %120
%122 = icmp eq i8 %119, %121
br i1 %122, label %123, label %146
123: ; preds = %116
%124 = or i64 %134, 3
%125 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %124
%126 = load i8, i8* %125
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %124
%128 = load i8, i8* %127
%129 = icmp eq i8 %126, %128
br i1 %129, label %130, label %146
130: ; preds = %123
%131 = add nuw nsw i64 %134, 4
%132 = icmp eq i64 %131, 1024
br i1 %132, label %140, label %133
133: ; preds = %105, %130
%134 = phi i64 [ %131, %130 ], [ 0, %105 ]
%135 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 %134
%136 = load i8, i8* %135
%137 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 %134
%138 = load i8, i8* %137
%139 = icmp eq i8 %136, %138
br i1 %139, label %109, label %146
140: ; preds = %130
%141 = tail call i32 @print(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%142 = tail call i64 @close(i32 %103)
%143 = icmp eq i64 %142, 0
br i1 %143, label %144, label %146
144: ; preds = %140
%145 = tail call i32 @print(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
br label %146
146: ; preds = %89, %65, %72, %79, %133, %109, %116, %123, %140, %105, %100, %96, %59, %55, %53, %45, %41, %144
%147 = phi i32 [ 0, %144 ], [ 1, %41 ], [ 2, %45 ], [ 3, %53 ], [ 4, %55 ], [ 5, %59 ], [ 7, %96 ], [ 8, %100 ], [ 9, %105 ], [ 11, %140 ], [ 10, %123 ], [ 10, %116 ], [ 10, %109 ], [ 10, %133 ], [ 6, %79 ], [ 6, %72 ], [ 6, %65 ], [ 6, %89 ]
ret i32 %147
}