#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 /*<<< orphan*/ divide(int, int, int *, int *);
int multiply(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int subt(int, int);
int main() {
  int a;
  int b;
  int sum;
  int diff;
  int product;
  int quotient = 0;
  int remndr = 0;
  printf("\n\nEnter two integers, separated by a space: ");
  scanf("%d %d", &a, &b);
  sum = add(a, b);
  diff = subt(a, b);
  product = multiply(a, b);
  divide(a, b, &quotient, &remndr);
  printf("\n%4d + %4d = %7d", a, b, sum);
  printf("\n%4d - %4d = %7d", a, b, diff);
  printf("\n%4d * %4d = %7d", a, b, product);
  printf("\n%4d / %4d = %7d, remainder %3d\n\n\n", a, b, quotient, remndr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1080 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <add@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <subt@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <multiply@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1060 <divide@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xea0(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1080 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <add@plt>
mov    %eax,%ebx
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1030 <subt@plt>
mov    %eax,%ebp
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <multiply@plt>
mov    %eax,%r14d
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1060 <divide@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe4a(%rip),%rdi
mov    %ebx,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe44(%rip),%rdi
mov    %ebp,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe3e(%rip),%rdi
mov    %r14d,%ecx
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
lea    0xe2e(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"\0A\0AEnter two integers, separated by a space: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [17 x i8] c"\0A%4d + %4d = %7d\00"
@.str.3 = [17 x i8] c"\0A%4d - %4d = %7d\00"
@.str.4 = [17 x i8] c"\0A%4d * %4d = %7d\00"
@.str.5 = [35 x i8] c"\0A%4d / %4d = %7d, remainder %3d\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %7
store i32 0, i32* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 @add(i32 %11, i32 %12)
store i32 %13, i32* %4
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = call i32 @subt(i32 %14, i32 %15)
store i32 %16, i32* %5
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = call i32 @multiply(i32 %17, i32 %18)
store i32 %19, i32* %6
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = call i32 @divide(i32 %20, i32 %21, i32* %7, i32* %8)
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 %24, i32 %25)
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = load i32, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %28, i32 %29)
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = load i32, i32* %6
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %31, i32 %32, i32 %33)
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = load i32, i32* %7
%38 = load i32, i32* %8
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %35, i32 %36, i32 %37, i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"\0A\0AEnter two integers, separated by a space: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [17 x i8] c"\0A%4d + %4d = %7d\00"
@.str.3 = [17 x i8] c"\0A%4d - %4d = %7d\00"
@.str.4 = [17 x i8] c"\0A%4d * %4d = %7d\00"
@.str.5 = [35 x i8] c"\0A%4d / %4d = %7d, remainder %3d\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = call i32 @add(i32 %11, i32 %12)
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = call i32 @subt(i32 %14, i32 %15)
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 @multiply(i32 %17, i32 %18)
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = call i32 @divide(i32 %20, i32 %21, i32* %3, i32* %4)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %23, i32 %24, i32 %13)
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 %27, i32 %16)
%29 = load i32, i32* %1
%30 = load i32, i32* %2
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %29, i32 %30, i32 %19)
%32 = load i32, i32* %1
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %32, i32 %33, i32 %34, i32 %35)
ret i32 0
}