#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 */
long long bar(void *);
int foo(void *x, long long *y) {
  char a[256];
  int i = 0;
  long long b;
  int c;
  int d = 0;
  int e = 0;
  unsigned f = 0;
  b = bar(x);
  c = (unsigned)b;
  while (d < b && d < 65557) {
    f = *(unsigned *)&a[0];
    for (i = c - 4; i > 0; i--)
      if (a[i + 0] == 0x50 && a[i + 1] == 0x4B && a[i + 3] == 0x06) {
        e = 1;
        break;
      }
  }
  return !e;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x114(%rbp)
movl   $0x0,-0x128(%rbp)
movl   $0x0,-0x12c(%rbp)
movl   $0x0,-0x130(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <bar@plt>
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rax
mov    %eax,-0x124(%rbp)
movslq -0x128(%rbp),%rcx
xor    %eax,%eax
cmp    -0x120(%rbp),%rcx
mov    %al,-0x131(%rbp)
jge    1197 <foo+0x87>
cmpl   $0x10015,-0x128(%rbp)
setl   %al
mov    %al,-0x131(%rbp)
mov    -0x131(%rbp),%al
test   $0x1,%al
jne    11aa <foo+0x9a>
jmp    1253 <foo+0x143>
mov    -0x110(%rbp),%eax
mov    %eax,-0x130(%rbp)
mov    -0x124(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x114(%rbp)
cmpl   $0x0,-0x114(%rbp)
jle    124e <foo+0x13e>
mov    -0x114(%rbp),%eax
add    $0x0,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x50,%eax
jne    1235 <foo+0x125>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%eax
cmp    $0x4b,%eax
jne    1235 <foo+0x125>
mov    -0x114(%rbp),%eax
add    $0x3,%eax
cltq
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x6,%eax
jne    1235 <foo+0x125>
movl   $0x1,-0x12c(%rbp)
jmp    124e <foo+0x13e>
jmp    123a <foo+0x12a>
mov    -0x114(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x114(%rbp)
jmp    11c5 <foo+0xb5>
jmp    1168 <foo+0x58>
cmpl   $0x0,-0x12c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
call   1030 <bar@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @foo(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
%5 = alloca [256 x i8]
%6 = alloca i32
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %3
store i64* %1, i64** %4
store i32 0, i32* %6
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
%12 = load i8*, i8** %3
%13 = call i64 @bar(i8* %12)
store i64 %13, i64* %7
%14 = load i64, i64* %7
%15 = trunc i64 %14 to i32
store i32 %15, i32* %8
br label %16
16: ; preds = %64, %2
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = load i64, i64* %7
%20 = icmp slt i64 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load i32, i32* %9
%23 = icmp slt i32 %22, 65557
br label %24
24: ; preds = %21, %16
%25 = phi i1 [ false, %16 ], [ %23, %21 ]
br i1 %25, label %26, label %65
26: ; preds = %24
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%28 = bitcast i8* %27 to i32*
%29 = load i32, i32* %28
store i32 %29, i32* %11
%30 = load i32, i32* %8
%31 = sub nsw i32 %30, 4
store i32 %31, i32* %6
br label %32
32: ; preds = %61, %26
%33 = load i32, i32* %6
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %64
35: ; preds = %32
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 0
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 80
br i1 %42, label %43, label %60
43: ; preds = %35
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 75
br i1 %50, label %51, label %60
51: ; preds = %43
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 3
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 6
br i1 %58, label %59, label %60
59: ; preds = %51
store i32 1, i32* %10
br label %64
60: ; preds = %51, %43, %35
br label %61
61: ; preds = %60
%62 = load i32, i32* %6
%63 = add nsw i32 %62, -1
store i32 %63, i32* %6
br label %32
64: ; preds = %59, %32
br label %16
65: ; preds = %24
%66 = load i32, i32* %10
%67 = icmp ne i32 %66, 0
%68 = xor i1 %67, true
%69 = zext i1 %68 to i32
ret i32 %69
}

LLVM IR (-O2):
define i32 @foo(i8* %0, i64* nocapture readnone %1) {
%3 = tail call i64 @bar(i8* %0)
%4 = icmp slt i64 %3, 1
ret i32 1
}