#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 division(int, int);
int multiplicacion(int, int);
int /*<<< orphan*/ printf(char *, int);
int rand();
int resta(int, int);
int suma(int, int);
int main() {
  int a = rand() % 1000;
  int b = rand() % 1000;
  int c;
  printf("a=%i\n", a);
  printf("b=%i\n", b);
  c = suma(a, b);
  printf("a+b=%i\n", c);
  c = resta(a, b);
  printf("a-b=%i\n", c);
  c = division(a, b);
  printf("a/b=%i\n", c);
  c = multiplicacion(a, b);
  printf("a*b=%i\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <suma@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1070 <resta@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <division@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe13(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <multiplicacion@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdfe(%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   1080 <rand@plt>
movslq %eax,%r14
imul   $0x10624dd3,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
imul   $0x3e8,%eax,%eax
sub    %eax,%r14d
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rbx
imul   $0x10624dd3,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
imul   $0x3e8,%eax,%eax
sub    %eax,%ebx
lea    0xe48(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r14d,%edi
mov    %ebx,%esi
call   1040 <suma@plt>
lea    0xe27(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14d,%edi
mov    %ebx,%esi
call   1070 <resta@plt>
lea    0xe17(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14d,%edi
mov    %ebx,%esi
call   1050 <division@plt>
lea    0xe07(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14d,%edi
mov    %ebx,%esi
call   1060 <multiplicacion@plt>
lea    0xdf7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"a=%i\0A\00"
@.str.1 = [6 x i8] c"b=%i\0A\00"
@.str.2 = [8 x i8] c"a+b=%i\0A\00"
@.str.3 = [8 x i8] c"a-b=%i\0A\00"
@.str.4 = [8 x i8] c"a/b=%i\0A\00"
@.str.5 = [8 x i8] c"a*b=%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 1000
store i32 %6, i32* %2
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 1000
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @suma(i32 %13, i32 %14)
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @resta(i32 %18, i32 %19)
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 @division(i32 %23, i32 %24)
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = call i32 @multiplicacion(i32 %28, i32 %29)
store i32 %30, i32* %4
%31 = load i32, i32* %4
%32 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"a=%i\0A\00"
@.str.1 = [6 x i8] c"b=%i\0A\00"
@.str.2 = [8 x i8] c"a+b=%i\0A\00"
@.str.3 = [8 x i8] c"a-b=%i\0A\00"
@.str.4 = [8 x i8] c"a/b=%i\0A\00"
@.str.5 = [8 x i8] c"a*b=%i\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 1000
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 1000
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%7 = tail call i32 @suma(i32 %2, i32 %4)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 @resta(i32 %2, i32 %4)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = tail call i32 @division(i32 %2, i32 %4)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = tail call i32 @multiplicacion(i32 %2, i32 %4)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %13)
ret i32 0
}