#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 add(int, int);
int drawline(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = 2, y = 4;
  int sum = add(2, 4);
  printf("sum: %d\n", add(x, y));
  int return_of_drawline = drawline(3);
  printf("drawline = %d\n", return_of_drawline);
  printf("%d\n", drawline(add(3, 4)));
  drawline(add(2, 4));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <add@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <add@plt>
mov    %eax,%esi
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
call   1050 <drawline@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <add@plt>
mov    %eax,%edi
call   1050 <drawline@plt>
mov    %eax,%esi
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <add@plt>
mov    %eax,%edi
call   1050 <drawline@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <add@plt>
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <add@plt>
lea    0xeaa(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
call   1050 <drawline@plt>
lea    0xe9b(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <add@plt>
mov    %eax,%edi
call   1050 <drawline@plt>
lea    0xe73(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x4,%esi
call   1030 <add@plt>
mov    %eax,%edi
call   1050 <drawline@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"sum: %d\0A\00"
@.str.1 = [15 x i8] c"drawline = %d\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 2, i32* %1
store i32 4, i32* %2
%5 = call i32 @add(i32 2, i32 4)
store i32 %5, i32* %3
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @add(i32 %6, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @drawline(i32 3)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 @add(i32 3, i32 4)
%14 = call i32 @drawline(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = call i32 @add(i32 2, i32 4)
%17 = call i32 @drawline(i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"sum: %d\0A\00"
@.str.1 = [15 x i8] c"drawline = %d\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @add(i32 2, i32 4)
%2 = tail call i32 @add(i32 2, i32 4)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @drawline(i32 3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @add(i32 3, i32 4)
%7 = tail call i32 @drawline(i32 %6)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 @add(i32 2, i32 4)
%10 = tail call i32 @drawline(i32 %9)
ret i32 0
}