#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 mul(int, int);
int /*<<< orphan*/ printf(char *, int);
int sub(int, int);
int main(int argc, char *argv[]) {
  int a = 10;
  int b = 5;
  printf("a+b=%d\n", add(a, b));
  printf("a-b=%d\n", sub(a, b));
  printf("a*b=%d\n", mul(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <add@plt>
mov    %eax,%esi
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1060 <sub@plt>
mov    %eax,%esi
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <mul@plt>
mov    %eax,%esi
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
mov    $0x5,%esi
call   1030 <add@plt>
lea    0xea9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x5,%esi
call   1060 <sub@plt>
lea    0xe94(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x5,%esi
call   1050 <mul@plt>
lea    0xe7f(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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