#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ foo();
main() {
  int i, j, k, ccp_bad = 0;
  for (i = 0; i < 10; i++) {
    for (j = 0; j < 10; j++)
      if (foo())
        ccp_bad = 1;
    k = ccp_bad != 0;
    if (k)
      abort();
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11c6 <main+0x96>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1193 <main+0x63>
mov    $0x0,%al
call   1040 <foo@plt>
cmp    $0x0,%rax
je     1180 <main+0x50>
movl   $0x1,-0x14(%rbp)
jmp    1185 <main+0x55>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115e <main+0x2e>
cmpl   $0x0,-0x14(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11b3 <main+0x83>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    11b8 <main+0x88>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x1d>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0xa,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,0x10(%rsp)
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,0x18(%rsp)
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,0x20(%rsp)
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,%r13
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,%r15
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1040 <foo@plt>
test   %rax,%rax
jne    120a <main+0xda>
test   %r12,%r12
jne    120a <main+0xda>
test   %r15,%r15
jne    120a <main+0xda>
test   %r14,%r14
jne    120a <main+0xda>
test   %rbp,%rbp
jne    120a <main+0xda>
test   %rbx,%rbx
jne    120a <main+0xda>
test   %r13,%r13
jne    120a <main+0xda>
cmpq   $0x0,0x20(%rsp)
jne    120a <main+0xda>
cmpq   $0x0,0x18(%rsp)
jne    120a <main+0xda>
cmpq   $0x0,0x10(%rsp)
jne    120a <main+0xda>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
jne    1150 <main+0x20>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %2
br label %6
6: ; preds = %30, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %33
9: ; preds = %6
store i32 0, i32* %3
br label %10
10: ; preds = %18, %9
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = call i64 (...) @foo()
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 1, i32* %5
br label %17
17: ; preds = %16, %13
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %10
21: ; preds = %10
%22 = load i32, i32* %5
%23 = icmp ne i32 %22, 0
%24 = zext i1 %23 to i32
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %21
%28 = call i32 (...) @abort()
unreachable
29: ; preds = %21
br label %30
30: ; preds = %29
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %6
33: ; preds = %6
%34 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
br label %4
1: ; preds = %4
%2 = add nuw nsw i32 %5, 1
%3 = icmp eq i32 %2, 10
br i1 %3, label %37, label %4
4: ; preds = %0, %1
%5 = phi i32 [ 0, %0 ], [ %2, %1 ]
%6 = tail call i64 (...) @foo()
%7 = icmp eq i64 %6, 0
%8 = tail call i64 (...) @foo()
%9 = icmp eq i64 %8, 0
%10 = tail call i64 (...) @foo()
%11 = icmp eq i64 %10, 0
%12 = tail call i64 (...) @foo()
%13 = icmp eq i64 %12, 0
%14 = tail call i64 (...) @foo()
%15 = icmp eq i64 %14, 0
%16 = tail call i64 (...) @foo()
%17 = icmp eq i64 %16, 0
%18 = tail call i64 (...) @foo()
%19 = icmp eq i64 %18, 0
%20 = tail call i64 (...) @foo()
%21 = icmp eq i64 %20, 0
%22 = tail call i64 (...) @foo()
%23 = icmp eq i64 %22, 0
%24 = tail call i64 (...) @foo()
%25 = icmp eq i64 %24, 0
%26 = select i1 %25, i1 %23, i1 false
%27 = select i1 %26, i1 %21, i1 false
%28 = select i1 %27, i1 %19, i1 false
%29 = select i1 %28, i1 %17, i1 false
%30 = select i1 %29, i1 %15, i1 false
%31 = select i1 %30, i1 %13, i1 false
%32 = select i1 %31, i1 %11, i1 false
%33 = select i1 %32, i1 %9, i1 false
%34 = select i1 %33, i1 %7, i1 false
br i1 %34, label %1, label %35
35: ; preds = %4
%36 = tail call i32 (...) @abort()
unreachable
37: ; preds = %1
%38 = tail call i32 @exit(i32 0)
unreachable
}