#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*/);
int f(int);
int g();
main() {
  int i, s;
  for (i = 0; i < 32; i++) {
    s = f(i);
    if (i == g())
      s = 42;
    if (i == 0 || s == 12)
      ;
    else
      abort();
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    11bf <main+0x7f>
mov    -0x8(%rbp),%edi
call   1040 <f@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <g@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jne    118c <main+0x4c>
movl   $0x2a,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11a0 <main+0x60>
cmpl   $0xc,-0xc(%rbp)
jne    11a5 <main+0x65>
jmp    11ac <main+0x6c>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    11b1 <main+0x71>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x16>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
jmp    1158 <main+0x18>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x20,%ebx
je     1182 <main+0x42>
mov    %ebx,%edi
call   1040 <f@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <g@plt>
cmp    %eax,%ebx
setne  %al
cmp    $0xc,%ebp
sete   %cl
test   %ebx,%ebx
je     1150 <main+0x10>
and    %cl,%al
jne    1150 <main+0x10>
xor    %eax,%eax
call   1030 <abort@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %24, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 32
br i1 %6, label %7, label %27
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 @f(i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = call i32 (...) @g()
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %7
store i32 42, i32* %3
br label %14
14: ; preds = %13, %7
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 12
br i1 %19, label %20, label %21
20: ; preds = %17, %14
br label %23
21: ; preds = %17
%22 = call i32 (...) @abort()
unreachable
23: ; preds = %20
br label %24
24: ; preds = %23
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %4
27: ; preds = %4
%28 = 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, 32
br i1 %3, label %15, label %4
4: ; preds = %0, %1
%5 = phi i32 [ 0, %0 ], [ %2, %1 ]
%6 = tail call i32 @f(i32 %5)
%7 = tail call i32 (...) @g()
%8 = icmp ne i32 %5, %7
%9 = icmp eq i32 %5, 0
%10 = icmp eq i32 %6, 12
%11 = select i1 %8, i1 %10, i1 false
%12 = select i1 %9, i1 true, i1 %11
br i1 %12, label %1, label %13
13: ; preds = %4
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %1
%16 = tail call i32 @exit(i32 0)
unreachable
}