#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*/ __builtin_outl(int, int);
int /*<<< orphan*/ foo();
void main(void) {
  int i;
  foo();
  foo();
  for (i = 0; i < 10; i++) {
    foo();
    __builtin_outl(i, 0x1234);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <foo@plt>
mov    $0x0,%al
call   1030 <foo@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1169 <main+0x49>
mov    $0x0,%al
call   1030 <foo@plt>
mov    -0x4(%rbp),%edi
mov    $0x1234,%esi
call   1040 <__builtin_outl@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <main+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %eax,%eax
call   1030 <foo@plt>
xor    %edi,%edi
mov    $0x1234,%esi
call   1040 <__builtin_outl@plt>
xor    %eax,%eax
call   1030 <foo@plt>
mov    $0x1,%edi
mov    $0x1234,%esi
call   1040 <__builtin_outl@plt>
xor    %eax,%eax
call   1030 <foo@plt>
mov    $0x2,%edi
mov    $0x1234,%esi
call   1040 <__builtin_outl@plt>
xor    %eax,%eax
call   1030 <foo@plt>
mov    $0x3,%edi
mov    $0x1234,%esi
call   1040 <__builtin_outl@plt>
xor    %eax,%eax
call   1030 <foo@plt>
mov    $0x4,%edi
mov    $0x1234,%esi
call   1040 <__builtin_outl@plt>
xor    %eax,%eax
call   1030 <foo@plt>
mov    $0x5,%edi
mov    $0x1234,%esi
call   1040 <__builtin_outl@plt>
xor    %eax,%eax
call   1030 <foo@plt>
mov    $0x6,%edi
mov    $0x1234,%esi
call   1040 <__builtin_outl@plt>
xor    %eax,%eax
call   1030 <foo@plt>
mov    $0x7,%edi
mov    $0x1234,%esi
call   1040 <__builtin_outl@plt>
xor    %eax,%eax
call   1030 <foo@plt>
mov    $0x8,%edi
mov    $0x1234,%esi
call   1040 <__builtin_outl@plt>
xor    %eax,%eax
call   1030 <foo@plt>
mov    $0x9,%edi
mov    $0x1234,%esi
pop    %rax
jmp    1040 <__builtin_outl@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = call i32 (...) @foo()
%3 = call i32 (...) @foo()
store i32 0, i32* %1
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = call i32 (...) @foo()
%9 = load i32, i32* %1
%10 = call i32 @__builtin_outl(i32 %9, i32 4660)
br label %11
11: ; preds = %7
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %4
14: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @foo()
%3 = tail call i32 (...) @foo()
%4 = tail call i32 @__builtin_outl(i32 0, i32 4660)
%5 = tail call i32 (...) @foo()
%6 = tail call i32 @__builtin_outl(i32 1, i32 4660)
%7 = tail call i32 (...) @foo()
%8 = tail call i32 @__builtin_outl(i32 2, i32 4660)
%9 = tail call i32 (...) @foo()
%10 = tail call i32 @__builtin_outl(i32 3, i32 4660)
%11 = tail call i32 (...) @foo()
%12 = tail call i32 @__builtin_outl(i32 4, i32 4660)
%13 = tail call i32 (...) @foo()
%14 = tail call i32 @__builtin_outl(i32 5, i32 4660)
%15 = tail call i32 (...) @foo()
%16 = tail call i32 @__builtin_outl(i32 6, i32 4660)
%17 = tail call i32 (...) @foo()
%18 = tail call i32 @__builtin_outl(i32 7, i32 4660)
%19 = tail call i32 (...) @foo()
%20 = tail call i32 @__builtin_outl(i32 8, i32 4660)
%21 = tail call i32 (...) @foo()
%22 = tail call i32 @__builtin_outl(i32 9, i32 4660)
ret void
}