#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 Original(int, int);
int /*<<< orphan*/ PreOriginal(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, long);
int main() {
  long res;
  int i;
  PreOriginal(6, 8);
  for (i = 0; i < 1000000; i++) {
    res = Original(6, 8);
  }
  if (((unsigned int)(res)) != (unsigned int)(0x2dc6c1)) {
    printf("***ERROR res %lx is unexpected\n", res);
    exit(-1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x6,%edi
mov    $0x8,%esi
call   1040 <PreOriginal@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xf4240,-0x14(%rbp)
jge    1193 <main+0x53>
mov    $0x6,%edi
mov    $0x8,%esi
call   1060 <Original@plt>
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1165 <main+0x25>
mov    -0x10(%rbp),%rax
cmp    $0x2dc6c1,%eax
je     11bc <main+0x7c>
mov    -0x10(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x6,%edi
mov    $0x8,%esi
call   1040 <PreOriginal@plt>
mov    $0xf4240,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x6,%edi
mov    $0x8,%esi
call   1060 <Original@plt>
add    $0xffffffff,%ebx
jne    1160 <main+0x20>
cmp    $0x2dc6c1,%eax
jne    117f <main+0x3f>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe7a(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"***ERROR res %lx is unexpected\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @PreOriginal(i32 6, i32 8)
store i32 0, i32* %3
br label %5
5: ; preds = %10, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 1000000
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = call i64 @Original(i32 6, i32 8)
store i64 %9, i64* %2
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %5
13: ; preds = %5
%14 = load i64, i64* %2
%15 = trunc i64 %14 to i32
%16 = icmp ne i32 %15, 3000001
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i64, i64* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %18)
%20 = call i32 @exit(i32 -1)
unreachable
21: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"***ERROR res %lx is unexpected\0A\00"
define i32 @main() {
%1 = tail call i32 @PreOriginal(i32 6, i32 8)
br label %2
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = tail call i64 @Original(i32 6, i32 8)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 1000000
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = trunc i64 %4 to i32
%9 = icmp eq i32 %8, 3000001
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %4)
%12 = tail call i32 @exit(i32 -1)
unreachable
13: ; preds = %7
ret i32 0
}