#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*/ expecti(int, int);
void test() {
  int accumulate = 0;
  for (int i = 0; i < 1024; i++)
    accumulate++;
  expecti(accumulate, 1024);
  for (int i = accumulate; i > 0; i--)
    accumulate--;
  expecti(accumulate, 0);
  for (int i = 1024; i > 0; i--)
    accumulate--;
  expecti(accumulate, -1024);
  int i;
  for (i = 0; i < 100; i++) {
    if (i == 99)
      break;
  }
  expecti(i, 99);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x400,-0x8(%rbp)
jge    114a <test+0x3a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <test+0x16>
mov    -0x4(%rbp),%edi
mov    $0x400,%esi
call   1030 <expecti@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    117e <test+0x6e>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    115d <test+0x4d>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <expecti@plt>
movl   $0x400,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    11b0 <test+0xa0>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    118f <test+0x7f>
mov    -0x4(%rbp),%edi
mov    $0xfffffc00,%esi
call   1030 <expecti@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    11f0 <test+0xe0>
cmpl   $0x63,-0x14(%rbp)
jne    11dd <test+0xcd>
jmp    11f0 <test+0xe0>
jmp    11e2 <test+0xd2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c4 <test+0xb4>
mov    -0x14(%rbp),%edi
mov    $0x63,%esi
call   1030 <expecti@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    $0x400,%edi
mov    $0x400,%esi
call   1030 <expecti@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <expecti@plt>
mov    $0xfffffc00,%edi
mov    $0xfffffc00,%esi
call   1030 <expecti@plt>
mov    $0x63,%edi
mov    $0x63,%esi
pop    %rax
jmp    1030 <expecti@plt>

LLVM IR (-O0):
define void @test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %6
6: ; preds = %12, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1024
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
store i32 %11, i32* %1
br label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %6
15: ; preds = %6
%16 = load i32, i32* %1
%17 = call i32 @expecti(i32 %16, i32 1024)
%18 = load i32, i32* %1
store i32 %18, i32* %3
br label %19
19: ; preds = %25, %15
%20 = load i32, i32* %3
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load i32, i32* %1
%24 = add nsw i32 %23, -1
store i32 %24, i32* %1
br label %25
25: ; preds = %22
%26 = load i32, i32* %3
%27 = add nsw i32 %26, -1
store i32 %27, i32* %3
br label %19
28: ; preds = %19
%29 = load i32, i32* %1
%30 = call i32 @expecti(i32 %29, i32 0)
store i32 1024, i32* %4
br label %31
31: ; preds = %37, %28
%32 = load i32, i32* %4
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i32, i32* %1
%36 = add nsw i32 %35, -1
store i32 %36, i32* %1
br label %37
37: ; preds = %34
%38 = load i32, i32* %4
%39 = add nsw i32 %38, -1
store i32 %39, i32* %4
br label %31
40: ; preds = %31
%41 = load i32, i32* %1
%42 = call i32 @expecti(i32 %41, i32 -1024)
store i32 0, i32* %5
br label %43
43: ; preds = %51, %40
%44 = load i32, i32* %5
%45 = icmp slt i32 %44, 100
br i1 %45, label %46, label %54
46: ; preds = %43
%47 = load i32, i32* %5
%48 = icmp eq i32 %47, 99
br i1 %48, label %49, label %50
49: ; preds = %46
br label %54
50: ; preds = %46
br label %51
51: ; preds = %50
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %43
54: ; preds = %49, %43
%55 = load i32, i32* %5
%56 = call i32 @expecti(i32 %55, i32 99)
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i32 @expecti(i32 1024, i32 1024)
%2 = tail call i32 @expecti(i32 0, i32 0)
%3 = tail call i32 @expecti(i32 -1024, i32 -1024)
%4 = tail call i32 @expecti(i32 99, i32 99)
ret void
}