#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 div(int, int);
int minus(int, int);
int mul(int, int);
int plus(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, b;
  printf(" Input a  number, please? ");
  scanf("%d", &a);
  printf(" Input a  number2, please?  ");
  scanf("%d", &b);
  printf(" a + b = %d    %x\n", plus(a, b), plus(a, b));
  printf(" a - b = %d    %x\n", minus(a, b), minus(a, b));
  printf(" a * b = %d     %x\n", mul(a, b), mul(a, b));
  if (b == 0)
    printf(" Unknown.\n");
  else
    printf(" a / b = %d    %x\n", div(a, b), div(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe97(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe79(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <plus@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <plus@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <minus@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <minus@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1080 <mul@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1080 <mul@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    124c <main+0xec>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1278 <main+0x118>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <div@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <div@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe91(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <scanf@plt>
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1030 <plus@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1030 <plus@plt>
lea    0xe66(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1050 <minus@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1050 <minus@plt>
lea    0xe4b(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1090 <mul@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1090 <mul@plt>
lea    0xe30(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%esi
test   %esi,%esi
je     1270 <main+0x100>
mov    0xc(%rsp),%edi
call   1070 <div@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1070 <div@plt>
lea    0xe12(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    127c <main+0x10c>
lea    0xe11(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c" Input a number, please? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c" Input a number2, please? \00"
@.str.3 = [19 x i8] c" a + b = %d %x\0A\00"
@.str.4 = [19 x i8] c" a - b = %d %x\0A\00"
@.str.5 = [20 x i8] c" a * b = %d %x\0A\00"
@.str.6 = [11 x i8] c" Unknown.\0A\00"
@.str.7 = [19 x i8] c" a / b = %d %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @plus(i32 %8, i32 %9)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 @plus(i32 %11, i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %10, i32 %13)
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @minus(i32 %15, i32 %16)
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @minus(i32 %18, i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %17, i32 %20)
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = call i32 @mul(i32 %22, i32 %23)
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = call i32 @mul(i32 %25, i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %24, i32 %27)
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %41
33: ; preds = %0
%34 = load i32, i32* %2
%35 = load i32, i32* %3
%36 = call i32 @div(i32 %34, i32 %35)
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = call i32 @div(i32 %37, i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %36, i32 %39)
br label %41
41: ; preds = %33, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c" Input a number, please? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c" Input a number2, please? \00"
@.str.3 = [19 x i8] c" a + b = %d %x\0A\00"
@.str.4 = [19 x i8] c" a - b = %d %x\0A\00"
@.str.5 = [20 x i8] c" a * b = %d %x\0A\00"
@.str.7 = [19 x i8] c" a / b = %d %x\0A\00"
@str = [10 x i8] c" Unknown.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call i32 @plus(i32 %9, i32 %10)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = call i32 @plus(i32 %12, i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %14)
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = call i32 @minus(i32 %16, i32 %17)
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = call i32 @minus(i32 %19, i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %18, i32 %21)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = call i32 @mul(i32 %23, i32 %24)
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = call i32 @mul(i32 %26, i32 %27)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %25, i32 %28)
%30 = load i32, i32* %2
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %0
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
br label %41
34: ; preds = %0
%35 = load i32, i32* %1
%36 = call i32 @div(i32 %35, i32 %30)
%37 = load i32, i32* %1
%38 = load i32, i32* %2
%39 = call i32 @div(i32 %37, i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %36, i32 %39)
br label %41
41: ; preds = %34, %32
ret i32 0
}