#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 /*<<< orphan*/ abort();
int foo(int);
int main() {
  int i;
  for (i = -10; i < 10; i++)
    if (foo(i) != 1 - 2 * (i == 4))
      abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffff6,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1181 <main+0x61>
mov    -0x8(%rbp),%edi
call   1040 <foo@plt>
cmpl   $0x4,-0x8(%rbp)
sete   %cl
and    $0x1,%cl
movzbl %cl,%edx
shl    $0x1,%edx
mov    $0x1,%ecx
sub    %edx,%ecx
cmp    %ecx,%eax
je     116e <main+0x4e>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1173 <main+0x53>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xfffffff6,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0xfffffff7,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0xfffffff8,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0xfffffff9,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0xfffffffa,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0xfffffffb,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0xfffffffc,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0xfffffffd,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0xfffffffe,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0xffffffff,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
xor    %edi,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0x1,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0x2,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0x3,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0x4,%edi
call   1040 <foo@plt>
cmp    $0xffffffff,%eax
jne    127a <main+0x15a>
mov    $0x5,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0x6,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0x7,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0x8,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
mov    $0x9,%edi
call   1040 <foo@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 -10, i32* %2
br label %3
3: ; preds = %18, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @foo(i32 %7)
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 4
%11 = zext i1 %10 to i32
%12 = mul nsw i32 2, %11
%13 = sub nsw i32 1, %12
%14 = icmp ne i32 %8, %13
br i1 %14, label %15, label %17
15: ; preds = %6
%16 = call i32 (...) @abort()
unreachable
17: ; preds = %6
br label %18
18: ; preds = %17
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %3
21: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 -10)
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %61
3: ; preds = %0
%4 = tail call i32 @foo(i32 -9)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %61
6: ; preds = %3
%7 = tail call i32 @foo(i32 -8)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %61
9: ; preds = %6
%10 = tail call i32 @foo(i32 -7)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %61
12: ; preds = %9
%13 = tail call i32 @foo(i32 -6)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %61
15: ; preds = %12
%16 = tail call i32 @foo(i32 -5)
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %61
18: ; preds = %15
%19 = tail call i32 @foo(i32 -4)
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %61
21: ; preds = %18
%22 = tail call i32 @foo(i32 -3)
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %61
24: ; preds = %21
%25 = tail call i32 @foo(i32 -2)
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %61
27: ; preds = %24
%28 = tail call i32 @foo(i32 -1)
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %61
30: ; preds = %27
%31 = tail call i32 @foo(i32 0)
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %61
33: ; preds = %30
%34 = tail call i32 @foo(i32 1)
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %61
36: ; preds = %33
%37 = tail call i32 @foo(i32 2)
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %61
39: ; preds = %36
%40 = tail call i32 @foo(i32 3)
%41 = icmp eq i32 %40, 1
br i1 %41, label %42, label %61
42: ; preds = %39
%43 = tail call i32 @foo(i32 4)
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %61
45: ; preds = %42
%46 = tail call i32 @foo(i32 5)
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %61
48: ; preds = %45
%49 = tail call i32 @foo(i32 6)
%50 = icmp eq i32 %49, 1
br i1 %50, label %51, label %61
51: ; preds = %48
%52 = tail call i32 @foo(i32 7)
%53 = icmp eq i32 %52, 1
br i1 %53, label %54, label %61
54: ; preds = %51
%55 = tail call i32 @foo(i32 8)
%56 = icmp eq i32 %55, 1
br i1 %56, label %57, label %61
57: ; preds = %54
%58 = tail call i32 @foo(i32 9)
%59 = icmp eq i32 %58, 1
br i1 %59, label %60, label %61
60: ; preds = %57
ret i32 0
61: ; preds = %57, %54, %51, %48, %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6, %3, %0
%62 = tail call i32 (...) @abort()
unreachable
}