#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 */
double pow(double, double);
int /*<<< orphan*/ printf(char *, int);
int rand();
int main(void) {
  int firstNumber = rand() % 10;
  int secondNumber = rand() % 10;
  int result = 0;
  printf("First Number:\t %d\n", firstNumber);
  printf("Second Number:\t %d\n", secondNumber);
  printf("Sum:\t\t %d\n", firstNumber + secondNumber);
  result = firstNumber - secondNumber;
  printf("Difference:\t %d\n", result);
  result = firstNumber * secondNumber;
  printf("Product:\t %d\n", result);
  result = firstNumber / secondNumber;
  printf("Division:\t %d.2\n", (float)result);
  result = (pow((double)firstNumber, (double)secondNumber)) + 0.005;
  printf("Power:\t\t %d\n", result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
add    -0x8(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0xc(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
cvttss2si %xmm0,%esi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
call   1040 <pow@plt>
movsd  0xe06(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%r14
imul   $0x66666667,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r14d
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rbx
imul   $0x66666667,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
lea    0xe82(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
lea    0xe86(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    (%rbx,%r14,1),%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    %r14d,%esi
sub    %ebx,%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%esi
imul   %r14d,%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movsbl %r14b,%eax
idiv   %bl
movsbl %al,%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sd %r14d,%xmm0
cvtsi2sd %ebx,%xmm1
call   1040 <pow@plt>
addsd  0xe06(%rip),%xmm0
cvttsd2si %xmm0,%esi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"First Number:\09 %d\0A\00"
@.str.1 = [20 x i8] c"Second Number:\09 %d\0A\00"
@.str.2 = [11 x i8] c"Sum:\09\09 %d\0A\00"
@.str.3 = [17 x i8] c"Difference:\09 %d\0A\00"
@.str.4 = [14 x i8] c"Product:\09 %d\0A\00"
@.str.5 = [17 x i8] c"Division:\09 %d.2\0A\00"
@.str.6 = [13 x i8] c"Power:\09\09 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @rand()
%5 = srem i32 %4, 10
store i32 %5, i32* %1
%6 = call i32 (...) @rand()
%7 = srem i32 %6, 10
store i32 %7, i32* %2
store i32 0, i32* %3
%8 = load i32, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = add nsw i32 %12, %13
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = sub nsw i32 %16, %17
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = mul nsw i32 %21, %22
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = sdiv i32 %26, %27
store i32 %28, i32* %3
%29 = load i32, i32* %3
%30 = sitofp i32 %29 to float
%31 = fptosi float %30 to i32
%32 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %1
%34 = sitofp i32 %33 to double
%35 = load i32, i32* %2
%36 = sitofp i32 %35 to double
%37 = call double @pow(double %34, double %36)
%38 = fadd double %37, 5.000000e-03
%39 = fptosi double %38 to i32
store i32 %39, i32* %3
%40 = load i32, i32* %3
%41 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"First Number:\09 %d\0A\00"
@.str.1 = [20 x i8] c"Second Number:\09 %d\0A\00"
@.str.2 = [11 x i8] c"Sum:\09\09 %d\0A\00"
@.str.3 = [17 x i8] c"Difference:\09 %d\0A\00"
@.str.4 = [14 x i8] c"Product:\09 %d\0A\00"
@.str.5 = [17 x i8] c"Division:\09 %d.2\0A\00"
@.str.6 = [13 x i8] c"Power:\09\09 %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 10
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 10
%5 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%7 = add nsw i32 %4, %2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = sub nsw i32 %2, %4
%10 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = mul nsw i32 %4, %2
%12 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = trunc i32 %2 to i8
%14 = trunc i32 %4 to i8
%15 = sdiv i8 %13, %14
%16 = sext i8 %15 to i32
%17 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %16)
%18 = sitofp i32 %2 to double
%19 = sitofp i32 %4 to double
%20 = tail call double @pow(double %18, double %19)
%21 = fadd double %20, 5.000000e-03
%22 = fptosi double %21 to i32
%23 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32 %22)
ret i32 0
}