#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 off_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, unsigned char *, int);
void searchfile(const char *filename, int fd, const unsigned char *value,
                const unsigned char *mask, int len) {
  off_t offset = 0;
  int r, o, i;
  unsigned char buf[1024];
  do {
    memcpy(buf, buf + len, len);
    r = read(fd, buf + len, 1024 - len);
    if (r > 0) {
      for (o = offset ? len : 0; o < r - len + 1; ++o) {
        for (i = 0; i < len; ++i)
          if ((buf[o + i] & mask[i]) != value[i])
            break;
        if (i == len) {
          printf("%s:%#010llx", filename,
                 (unsigned long long)(offset + o - len));
          if (len < 16) {
            printf(" ");
            for (i = -4; i < (len + 4); i++) {
              if (i == 0)
                printf("\033[1;31m");
              printf("%02x", buf[o + i]);
              if (i + 1 == len)
                printf("\033[1;0m");
            }
          }
          printf("\n");
        }
      }
      offset += r;
    } else if (r < 0)
      perror("read");
  } while (r > 0);
}


x86 assembly (clang, -O0):
<searchfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0x440(%rbp),%rdi
lea    -0x440(%rbp),%rsi
movslq -0x24(%rbp),%rax
add    %rax,%rsi
mov    -0x24(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0xc(%rbp),%edi
lea    -0x440(%rbp),%rsi
movslq -0x24(%rbp),%rax
add    %rax,%rsi
mov    $0x400,%edx
sub    -0x24(%rbp),%edx
call   1040 <read@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    1340 <searchfile+0x200>
cmpl   $0x0,-0x28(%rbp)
je     11c5 <searchfile+0x85>
mov    -0x24(%rbp),%eax
mov    %eax,-0x444(%rbp)
jmp    11d2 <searchfile+0x92>
xor    %eax,%eax
mov    %eax,-0x444(%rbp)
jmp    11d2 <searchfile+0x92>
mov    -0x444(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x2c(%rbp),%ecx
sub    -0x24(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1332 <searchfile+0x1f2>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    124c <searchfile+0x10c>
mov    -0x30(%rbp),%eax
add    -0x34(%rbp),%eax
cltq
movzbl -0x440(%rbp,%rax,1),%eax
ff
mov    -0x20(%rbp),%rcx
movslq -0x34(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
and    %ecx,%eax
mov    -0x18(%rbp),%rcx
movslq -0x34(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1239 <searchfile+0xf9>
jmp    124c <searchfile+0x10c>
jmp    123e <searchfile+0xfe>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11f6 <searchfile+0xb6>
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    131f <searchfile+0x1df>
mov    -0x8(%rbp),%rsi
mov    -0x28(%rbp),%eax
add    -0x30(%rbp),%eax
sub    -0x24(%rbp),%eax
movslq %eax,%rdx
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x10,-0x24(%rbp)
jge    1311 <searchfile+0x1d1>
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xfffffffc,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x24(%rbp),%ecx
add    $0x4,%ecx
cmp    %ecx,%eax
jge    130c <searchfile+0x1cc>
cmpl   $0x0,-0x34(%rbp)
jne    12be <searchfile+0x17e>
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    -0x34(%rbp),%eax
cltq
movzbl -0x440(%rbp,%rax,1),%esi
ff
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cmp    -0x24(%rbp),%eax
jne    12f9 <searchfile+0x1b9>
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12fe <searchfile+0x1be>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1295 <searchfile+0x155>
jmp    1311 <searchfile+0x1d1>
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1324 <searchfile+0x1e4>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11db <searchfile+0x9b>
mov    -0x2c(%rbp),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    135b <searchfile+0x21b>
cmpl   $0x0,-0x2c(%rbp)
jge    1356 <searchfile+0x216>
lea    0xcd3(%rip),%rdi
call   1060 <perror@plt>
jmp    135b <searchfile+0x21b>
jmp    1360 <searchfile+0x220>
cmpl   $0x0,-0x2c(%rbp)
jg     1165 <searchfile+0x25>
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<searchfile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x468,%rsp
mov    %r8d,%r14d
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %esi,0x18(%rsp)
mov    %rdi,0x50(%rsp)
movslq %r8d,%rax
lea    (%rsp,%rax,1),%r13
add    $0x60,%r13
mov    $0x400,%ebp
sub    %eax,%ebp
add    $0x3,%eax
cmp    $0xfffffffd,%eax
mov    $0xfffffffc,%r12d
cmovge %eax,%r12d
lea    0x60(%rsp),%rdi
mov    %r13,%rsi
mov    %r8d,%edx
call   1060 <memcpy@plt>
mov    0x18(%rsp),%edi
mov    %r13,0x40(%rsp)
mov    %r13,%rsi
mov    %ebp,0x20(%rsp)
mov    %ebp,%edx
call   1050 <read@plt>
mov    %eax,%ecx
test   %eax,%eax
jle    148a <searchfile+0x33a>
mov    %r12,0x30(%rsp)
lea    0x1(%r12),%eax
mov    %eax,0xc(%rsp)
mov    $0x1,%eax
sub    %r14d,%eax
mov    %rax,0x38(%rsp)
mov    %r14d,%r12d
lea    -0x2(%r14),%eax
mov    %rax,0x48(%rsp)
xor    %ebp,%ebp
mov    %r14,0x10(%rsp)
jmp    1237 <searchfile+0xe7>
cs nopw 0x0(%rax,%rax,1)
mov    0x1c(%rsp),%ebp
add    0x28(%rsp),%ebp
lea    0x60(%rsp),%rdi
mov    0x40(%rsp),%r13
mov    %r13,%rsi
mov    %r14d,%edx
call   1060 <memcpy@plt>
mov    0x18(%rsp),%edi
mov    %r13,%rsi
mov    0x20(%rsp),%edx
call   1050 <read@plt>
mov    %eax,%ecx
test   %eax,%eax
jle    148a <searchfile+0x33a>
test   %ebp,%ebp
mov    %r14d,%eax
mov    %ebp,0x1c(%rsp)
cmove  %ebp,%eax
mov    %rcx,%rdx
mov    %rcx,0x28(%rsp)
sub    %r14d,%ecx
cmp    %ecx,%eax
jg     1200 <searchfile+0xb0>
mov    0x1c(%rsp),%ecx
sub    %r14d,%ecx
mov    %rcx,0x58(%rsp)
movslq %eax,%rbp
mov    0x38(%rsp),%rax
mov    0x28(%rsp),%rcx
add    %ecx,%eax
mov    %eax,0x24(%rsp)
lea    (%rsp,%rbp,1),%r13
add    $0x60,%r13
jmp    12a1 <searchfile+0x151>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x10(%rsp),%r14
add    $0x1,%rbp
add    $0x1,%r13
cmp    %ebp,0x24(%rsp)
je     1200 <searchfile+0xb0>
xor    %eax,%eax
test   %r14d,%r14d
jle    12d0 <searchfile+0x180>
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rax,1),%ecx
and    0x0(%r13,%rax,1),%cl
cmp    (%rbx,%rax,1),%cl
jne    12d0 <searchfile+0x180>
add    $0x1,%rax
cmp    %rax,%r12
jne    12b0 <searchfile+0x160>
jmp    12d5 <searchfile+0x185>
nopw   0x0(%rax,%rax,1)
cmp    %r14d,%eax
jne    128f <searchfile+0x13f>
mov    0x58(%rsp),%rax
add    %ebp,%eax
movslq %eax,%rdx
lea    0xd1a(%rip),%rdi
mov    0x50(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xf,%r14d
jg     1280 <searchfile+0x130>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmpl   $0xfffffff9,0x10(%rsp)
jl     1280 <searchfile+0x130>
lea    0x60(%rsp),%rax
movzbl -0x4(%rbp,%rax,1),%esi
lea    0xcf6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0xfffffffd,0x10(%rsp)
jne    133a <searchfile+0x1ea>
lea    0xce6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0xfffffffd,0xc(%rsp)
je     1280 <searchfile+0x130>
lea    0x60(%rsp),%rax
movzbl -0x3(%rbp,%rax,1),%esi
lea    0xcbe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0xfffffffe,0x10(%rsp)
jne    1372 <searchfile+0x222>
lea    0xcae(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0xfffffffe,0xc(%rsp)
je     1280 <searchfile+0x130>
lea    0x60(%rsp),%rax
movzbl -0x2(%rbp,%rax,1),%esi
lea    0xc86(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0xffffffff,0x10(%rsp)
je     13a8 <searchfile+0x258>
cmpl   $0xffffffff,0xc(%rsp)
jne    13c1 <searchfile+0x271>
jmp    1280 <searchfile+0x130>
lea    0xc6a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0xffffffff,0xc(%rsp)
je     1280 <searchfile+0x130>
lea    0x60(%rsp),%rax
movzbl -0x1(%rbp,%rax,1),%esi
lea    0xc42(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x10(%rsp)
je     13ec <searchfile+0x29c>
cmpl   $0x0,0xc(%rsp)
jne    1405 <searchfile+0x2b5>
jmp    1280 <searchfile+0x130>
lea    0xc26(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0xc(%rsp)
je     1280 <searchfile+0x130>
lea    0xc00(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x60(%rsp,%rbp,1),%esi
lea    0xbf5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x1,0x10(%rsp)
jne    143b <searchfile+0x2eb>
lea    0xbe5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x30(%rsp)
je     1280 <searchfile+0x130>
xor    %r14d,%r14d
jmp    145f <searchfile+0x30f>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
cmp    %r14d,0x30(%rsp)
je     1280 <searchfile+0x130>
movzbl 0x1(%r13,%r14,1),%esi
lea    0xba8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r14d,0x48(%rsp)
jne    1450 <searchfile+0x300>
lea    0xb98(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1450 <searchfile+0x300>
test   %ecx,%ecx
js     14a0 <searchfile+0x350>
add    $0x468,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb79(%rip),%rdi
call   1070 <perror@plt>
jmp    148e <searchfile+0x33e>

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

LLVM IR (-O2):
@.str = [12 x i8] c"%s:%llx\00"
@.str.2 = [8 x i8] c"\1B[1;31m\00"
@.str.3 = [5 x i8] c"%02x\00"
@.str.4 = [7 x i8] c"\1B[1;0m\00"
@.str.6 = [5 x i8] c"read\00"
define void @searchfile(i8* %0, i32 %1, i8* nocapture %2, i8* nocapture %3, i32 %4) {
%6 = alloca [1024 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%8 = sext i32 %4 to i64
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %8
%10 = sub nsw i32 1024, %4
%11 = icmp sgt i32 %4, 0
%12 = icmp slt i32 %4, 16
%13 = icmp sgt i32 %4, -8
%14 = add i32 %4, 3
%15 = call i32 @llvm.smax.i32(i32 %14, i32 -4)
%16 = add i32 %15, 1
%17 = sub i32 1, %4
%18 = zext i32 %4 to i64
%19 = icmp eq i32 %4, -3
%20 = icmp eq i32 %16, -3
%21 = icmp eq i32 %4, -2
%22 = icmp eq i32 %16, -2
%23 = icmp eq i32 %4, -1
%24 = icmp eq i32 %16, -1
%25 = icmp eq i32 %4, 0
%26 = icmp eq i32 %16, 0
%27 = icmp eq i32 %4, 1
%28 = icmp eq i32 %15, 0
%29 = call i32 @memcpy(i8* %7, i8* %9, i32 %4)
%30 = call i32 @read(i32 %1, i8* %9, i32 %10)
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %136
32: ; preds = %5, %141
%33 = phi i32 [ %144, %141 ], [ %30, %5 ]
%34 = phi i32 [ %142, %141 ], [ 0, %5 ]
%35 = icmp eq i32 %34, 0
%36 = select i1 %35, i32 0, i32 %4
%37 = sub nsw i32 %33, %4
%38 = icmp sgt i32 %36, %37
br i1 %38, label %141, label %39
39: ; preds = %32
%40 = sub i32 %34, %4
%41 = sext i32 %36 to i64
%42 = add i32 %17, %33
br label %43
43: ; preds = %39, %132
%44 = phi i64 [ %41, %39 ], [ %133, %132 ]
br i1 %11, label %45, label %61
45: ; preds = %43, %56
%46 = phi i64 [ %57, %56 ], [ 0, %43 ]
%47 = add nsw i64 %46, %44
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = getelementptr inbounds i8, i8* %3, i64 %46
%51 = load i8, i8* %50
%52 = and i8 %51, %49
%53 = getelementptr inbounds i8, i8* %2, i64 %46
%54 = load i8, i8* %53
%55 = icmp eq i8 %52, %54
br i1 %55, label %56, label %59
56: ; preds = %45
%57 = add nuw nsw i64 %46, 1
%58 = icmp eq i64 %57, %18
br i1 %58, label %64, label %45
59: ; preds = %45
%60 = trunc i64 %46 to i32
br label %61
61: ; preds = %59, %43
%62 = phi i32 [ 0, %43 ], [ %60, %59 ]
%63 = icmp eq i32 %62, %4
br i1 %63, label %64, label %132
64: ; preds = %56, %61
%65 = trunc i64 %44 to i32
%66 = add i32 %40, %65
%67 = sext i32 %66 to i64
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %67)
br i1 %12, label %69, label %130
69: ; preds = %64
%70 = call i32 @putchar(i32 32)
br i1 %13, label %71, label %130
71: ; preds = %69
%72 = add nsw i64 %44, -4
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %72
%74 = load i8, i8* %73
%75 = zext i8 %74 to i32
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %75)
br i1 %19, label %77, label %79
77: ; preds = %71
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %79
79: ; preds = %77, %71
br i1 %20, label %130, label %80
80: ; preds = %79
%81 = add nsw i64 %44, -3
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = zext i8 %83 to i32
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %84)
br i1 %21, label %86, label %88
86: ; preds = %80
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %88
88: ; preds = %86, %80
br i1 %22, label %130, label %89
89: ; preds = %88
%90 = add nsw i64 %44, -2
%91 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %90
%92 = load i8, i8* %91
%93 = zext i8 %92 to i32
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %93)
br i1 %23, label %95, label %97
95: ; preds = %89
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %97
97: ; preds = %95, %89
br i1 %24, label %130, label %98
98: ; preds = %97
%99 = add nsw i64 %44, -1
%100 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %99
%101 = load i8, i8* %100
%102 = zext i8 %101 to i32
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %102)
br i1 %25, label %104, label %106
104: ; preds = %98
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %106
106: ; preds = %104, %98
br i1 %26, label %130, label %107
107: ; preds = %106
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%109 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %44
%110 = load i8, i8* %109
%111 = zext i8 %110 to i32
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %111)
br i1 %27, label %113, label %115
113: ; preds = %107
%114 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %115
115: ; preds = %113, %107
br i1 %28, label %130, label %116
116: ; preds = %115, %128
%117 = phi i64 [ %123, %128 ], [ 1, %115 ]
%118 = add nsw i64 %117, %44
%119 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %118
%120 = load i8, i8* %119
%121 = zext i8 %120 to i32
%122 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %121)
%123 = add nuw nsw i64 %117, 1
%124 = trunc i64 %123 to i32
%125 = icmp eq i32 %124, %4
br i1 %125, label %126, label %128
126: ; preds = %116
%127 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %128
128: ; preds = %116, %126
%129 = icmp eq i32 %16, %124
br i1 %129, label %130, label %116
130: ; preds = %128, %79, %88, %97, %106, %115, %69, %64
%131 = call i32 @putchar(i32 10)
br label %132
132: ; preds = %61, %130
%133 = add nsw i64 %44, 1
%134 = trunc i64 %133 to i32
%135 = icmp eq i32 %42, %134
br i1 %135, label %141, label %43
136: ; preds = %141, %5
%137 = phi i32 [ %30, %5 ], [ %144, %141 ]
%138 = icmp slt i32 %137, 0
br i1 %138, label %139, label %146
139: ; preds = %136
%140 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %146
141: ; preds = %132, %32
%142 = add nsw i32 %33, %34
%143 = call i32 @memcpy(i8* %7, i8* %9, i32 %4)
%144 = call i32 @read(i32 %1, i8* %9, i32 %10)
%145 = icmp sgt i32 %144, 0
br i1 %145, label %32, label %136
146: ; preds = %136, %139
ret void
}