#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*/ test(char *, char *);
void TEST_function_call(void) {
  test("foo", "main() { bar(); } bar() { printf(\"foo\"); }");
  test("foo", "bar() { printf(\"foo\"); } main() { bar(); }");
  test("17", "main() { printf(\"%d\", bar()); } bar() { return 17; }");
  test("1 2",
       "main() { bar(1, 2); } bar(int i, int j) { printf(\"%d %d\", i, j); }");
  test("17 42", "main() { int p[3]; p[0]=17; p[1]=42; bar(p); } bar(int *p) { "
                "printf(\"%d %d\", p[0], p[1]); }");
  test("3", "int main() { printf(\"%d\", foo(3)); } int foo(int arg) { return "
            "arg; }");
}


x86 assembly (clang, -O0):
<TEST_function_call>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <test@plt>
lea    0xed2(%rip),%rdi
lea    0xefa(%rip),%rsi
call   1030 <test@plt>
lea    0xf19(%rip),%rdi
lea    0xf15(%rip),%rsi
call   1030 <test@plt>
lea    0xf3e(%rip),%rdi
lea    0xf3b(%rip),%rsi
call   1030 <test@plt>
lea    0xf72(%rip),%rdi
lea    0xf71(%rip),%rsi
call   1030 <test@plt>
lea    0xfc1(%rip),%rdi
lea    0xfbc(%rip),%rsi
call   1030 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TEST_function_call>:
push   %rbx
lea    0xee8(%rip),%rbx
lea    0xee5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test@plt>
lea    0xf01(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test@plt>
lea    0xf1d(%rip),%rdi
lea    0xf19(%rip),%rsi
call   1030 <test@plt>
lea    0xf42(%rip),%rdi
lea    0xf3f(%rip),%rsi
call   1030 <test@plt>
lea    0xf76(%rip),%rdi
lea    0xf75(%rip),%rsi
call   1030 <test@plt>
lea    0xfc5(%rip),%rdi
lea    0xfc0(%rip),%rsi
pop    %rbx
jmp    1030 <test@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
@.str.1 = [43 x i8] c"main() { bar(); } bar() { printf(\22foo\22); }\00"
@.str.2 = [43 x i8] c"bar() { printf(\22foo\22); } main() { bar(); }\00"
@.str.3 = [3 x i8] c"17\00"
@.str.4 = [53 x i8] c"main() { printf(\22%d\22, bar()); } bar() { return 17; }\00"
@.str.5 = [4 x i8] c"1 2\00"
@.str.6 = [67 x i8] c"main() { bar(1, 2); } bar(int i, int j) { printf(\22%d %d\22, i, j); }\00"
@.str.7 = [6 x i8] c"17 42\00"
@.str.8 = [92 x i8] c"main() { int p[3]; p[0]=17; p[1]=42; bar(p); } bar(int *p) { printf(\22%d %d\22, p[0], p[1]); }\00"
@.str.9 = [2 x i8] c"3\00"
@.str.10 = [70 x i8] c"int main() { printf(\22%d\22, foo(3)); } int foo(int arg) { return arg; }\00"
define void @TEST_function_call() {
%1 = call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0))
%4 = call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.6, i64 0, i64 0))
%5 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.8, i64 0, i64 0))
%6 = call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.10, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
@.str.1 = [43 x i8] c"main() { bar(); } bar() { printf(\22foo\22); }\00"
@.str.2 = [43 x i8] c"bar() { printf(\22foo\22); } main() { bar(); }\00"
@.str.3 = [3 x i8] c"17\00"
@.str.4 = [53 x i8] c"main() { printf(\22%d\22, bar()); } bar() { return 17; }\00"
@.str.5 = [4 x i8] c"1 2\00"
@.str.6 = [67 x i8] c"main() { bar(1, 2); } bar(int i, int j) { printf(\22%d %d\22, i, j); }\00"
@.str.7 = [6 x i8] c"17 42\00"
@.str.8 = [92 x i8] c"main() { int p[3]; p[0]=17; p[1]=42; bar(p); } bar(int *p) { printf(\22%d %d\22, p[0], p[1]); }\00"
@.str.9 = [2 x i8] c"3\00"
@.str.10 = [70 x i8] c"int main() { printf(\22%d\22, foo(3)); } int foo(int arg) { return arg; }\00"
define void @TEST_function_call() {
%1 = tail call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0))
%4 = tail call i32 @test(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.6, i64 0, i64 0))
%5 = tail call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.8, i64 0, i64 0))
%6 = tail call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.10, i64 0, i64 0))
ret void
}