#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ proc_call_overhead(int);
int /*<<< orphan*/ stdout;
void benchmark_proc_call() {
  int i;
  for (i = 0; i <= 7; i++) {
    fprintf(stdout, "--------------------------\n");
    proc_call_overhead(i);
  }
}


x86 assembly (clang, -O0):
<benchmark_proc_call>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x7,-0x4(%rbp)
jg     1164 <benchmark_proc_call+0x44>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1030 <proc_call_overhead@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <benchmark_proc_call+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<benchmark_proc_call>:
push   %r14
push   %rbx
push   %rax
mov    0x2eb5(%rip),%r14
mov    (%r14),%edi
lea    0xecb(%rip),%rbx
mov    %rbx,%rsi
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1030 <proc_call_overhead@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1030 <proc_call_overhead@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    $0x2,%edi
call   1030 <proc_call_overhead@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    $0x3,%edi
call   1030 <proc_call_overhead@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    $0x4,%edi
call   1030 <proc_call_overhead@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    $0x5,%edi
call   1030 <proc_call_overhead@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    $0x6,%edi
call   1030 <proc_call_overhead@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    $0x7,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <proc_call_overhead@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [28 x i8] c"--------------------------\0A\00"
define void @benchmark_proc_call() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %10, %0
%3 = load i32, i32* %1
%4 = icmp sle i32 %3, 7
br i1 %4, label %5, label %13
5: ; preds = %2
%6 = load i32, i32* @stdout
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = call i32 @proc_call_overhead(i32 %8)
br label %10
10: ; preds = %5
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %2
13: ; preds = %2
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [28 x i8] c"--------------------------\0A\00"
define void @benchmark_proc_call() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @proc_call_overhead(i32 0)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @proc_call_overhead(i32 1)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @proc_call_overhead(i32 2)
%10 = load i32, i32* @stdout
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @proc_call_overhead(i32 3)
%13 = load i32, i32* @stdout
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @proc_call_overhead(i32 4)
%16 = load i32, i32* @stdout
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%18 = tail call i32 @proc_call_overhead(i32 5)
%19 = load i32, i32* @stdout
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%21 = tail call i32 @proc_call_overhead(i32 6)
%22 = load i32, i32* @stdout
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%24 = tail call i32 @proc_call_overhead(i32 7)
ret void
}