#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 del(int, int);
double div(int, int);
int mul(int, int);
int /*<<< orphan*/ printf(char *, int, int, double);
int main() {
  int x = 10, y = 20;
  printf("%d + %d = %d\n", x, y, add(x, y));
  printf("%d - %d = %d\n", x, y, del(x, y));
  printf("%d * %d = %d\n", x, y, mul(x, y));
  printf("%d / %d = %.2f\n", x, y, div(x, y));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <add@plt>
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%edx
cvtsi2sd %eax,%xmm0
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <del@plt>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
cvtsi2sd %eax,%xmm0
lea    0xe4c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <mul@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
cvtsi2sd %eax,%xmm0
lea    0xe2d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <div@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe12(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
mov    $0x14,%esi
call   1030 <add@plt>
cvtsi2sd %eax,%xmm0
lea    0xe95(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x14,%esi
call   1070 <del@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe77(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x14,%esi
call   1060 <mul@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe59(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x14,%esi
call   1050 <div@plt>
lea    0xe42(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%d + %d = %d\0A\00"
@.str.1 = [14 x i8] c"%d - %d = %d\0A\00"
@.str.2 = [14 x i8] c"%d * %d = %d\0A\00"
@.str.3 = [16 x i8] c"%d / %d = %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @add(i32 %6, i32 %7)
%9 = sitofp i32 %8 to double
%10 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5, double %9)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @del(i32 %13, i32 %14)
%16 = sitofp i32 %15 to double
%17 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %12, double %16)
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = call i32 @mul(i32 %20, i32 %21)
%23 = sitofp i32 %22 to double
%24 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %19, double %23)
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = call double @div(i32 %27, i32 %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %25, i32 %26, double %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d + %d = %d\0A\00"
@.str.1 = [14 x i8] c"%d - %d = %d\0A\00"
@.str.2 = [14 x i8] c"%d * %d = %d\0A\00"
@.str.3 = [16 x i8] c"%d / %d = %.2f\0A\00"
define i32 @main() {
%1 = tail call i32 @add(i32 10, i32 20)
%2 = sitofp i32 %1 to double
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 20, double %2)
%4 = tail call i32 @del(i32 10, i32 20)
%5 = sitofp i32 %4 to double
%6 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 20, double %5)
%7 = tail call i32 @mul(i32 10, i32 20)
%8 = sitofp i32 %7 to double
%9 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 20, double %8)
%10 = tail call double @div(i32 10, i32 20)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 10, i32 20, double %10)
ret i32 0
}