#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 div(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int mod(int, int);
int mul(int, int);
int /*<<< orphan*/ stdout;
int sub(int, int);
void use_math(void) {
  fprintf(stdout, "use add => 3 + 2 = %d\n", add(3, 2));
  fprintf(stdout, "use sub => 3 - 2 = %d\n", sub(3, 2));
  fprintf(stdout, "use mul => 3 * 2 = %d\n", mul(3, 2));
  fprintf(stdout, "use div => 3 / 2 = %d\n", div(3, 2));
  fprintf(stdout, "use mod => 3 %% 2 = %d\n", mod(3, 2));
}


x86 assembly (clang, -O0):
<use_math>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    $0x3,%edi
mov    $0x2,%esi
call   1040 <add@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%edx
lea    0xe71(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    $0x3,%edi
mov    $0x2,%esi
call   1080 <sub@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%edx
lea    0xe5c(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    $0x3,%edi
mov    $0x2,%esi
call   1070 <mul@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%edx
lea    0xe47(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x3,%edi
mov    $0x2,%esi
call   1060 <div@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%edx
lea    0xe32(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2dc1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x3,%edi
mov    $0x2,%esi
call   1030 <mod@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%edx
lea    0xe1d(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<use_math>:
push   %r14
push   %rbx
push   %rax
mov    0x2e75(%rip),%r14
mov    (%r14),%ebx
mov    $0x3,%edi
mov    $0x2,%esi
call   1040 <add@plt>
lea    0xe7c(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
call   1050 <fprintf@plt>
mov    (%r14),%ebx
mov    $0x3,%edi
mov    $0x2,%esi
call   1080 <sub@plt>
lea    0xe71(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
call   1050 <fprintf@plt>
mov    (%r14),%ebx
mov    $0x3,%edi
mov    $0x2,%esi
call   1070 <mul@plt>
lea    0xe66(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
call   1050 <fprintf@plt>
mov    (%r14),%ebx
mov    $0x3,%edi
mov    $0x2,%esi
call   1060 <div@plt>
lea    0xe5b(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
call   1050 <fprintf@plt>
mov    (%r14),%ebx
mov    $0x3,%edi
mov    $0x2,%esi
call   1030 <mod@plt>
lea    0xe50(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [23 x i8] c"use add => 3 + 2 = %d\0A\00"
@.str.1 = [23 x i8] c"use sub => 3 - 2 = %d\0A\00"
@.str.2 = [23 x i8] c"use mul => 3 * 2 = %d\0A\00"
@.str.3 = [23 x i8] c"use div => 3 / 2 = %d\0A\00"
@.str.4 = [24 x i8] c"use mod => 3 %% 2 = %d\0A\00"
define void @use_math() {
%1 = load i32, i32* @stdout
%2 = call i32 @add(i32 3, i32 2)
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @stdout
%5 = call i32 @sub(i32 3, i32 2)
%6 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @stdout
%8 = call i32 @mul(i32 3, i32 2)
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @stdout
%11 = call i32 @div(i32 3, i32 2)
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @stdout
%14 = call i32 @mod(i32 3, i32 2)
%15 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %14)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [23 x i8] c"use add => 3 + 2 = %d\0A\00"
@.str.1 = [23 x i8] c"use sub => 3 - 2 = %d\0A\00"
@.str.2 = [23 x i8] c"use mul => 3 * 2 = %d\0A\00"
@.str.3 = [23 x i8] c"use div => 3 / 2 = %d\0A\00"
@.str.4 = [24 x i8] c"use mod => 3 %% 2 = %d\0A\00"
define void @use_math() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @add(i32 3, i32 2)
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @stdout
%5 = tail call i32 @sub(i32 3, i32 2)
%6 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @stdout
%8 = tail call i32 @mul(i32 3, i32 2)
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @stdout
%11 = tail call i32 @div(i32 3, i32 2)
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = load i32, i32* @stdout
%14 = tail call i32 @mod(i32 3, i32 2)
%15 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %14)
ret void
}