#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 /*<<< orphan*/ divisaoA(float, float);
int /*<<< orphan*/ multi(float, float);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ soma(float, float);
int /*<<< orphan*/ subtracao(float, float);
int main() {
  float a, b;
  int op;
  do {
    printf("\nDigite um numero:\n ");
    scanf("%f", &a);
    printf("Digite outro numero:\n");
    scanf("%f", &b);
    printf("Escolha sua operaçao abaixo:\n");
    printf("1 = soma\n2 = subtraçao\n3 = divisao\n4 = multiplicaçao\n0 (zero) "
           "para sair!\n");
    scanf("%i", &op);
    if (op == 1) {
      printf("Sua soma e: \n");
      soma(a, b);
    }
    if (op == 2) {
      printf("Sua subtraçao e: \n");
      subtracao(a, b);
    }
    if (op == 3) {
      printf("Sua divisao e: \n");
      divisaoA(a, b);
    }
    if (op == 4) {
      printf("Sua multplicaçao e: \n");
      multi(a, b);
    }
  } while (op != 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1080 <scanf@plt>
cmpl   $0x1,-0x10(%rbp)
jne    11fa <main+0x9a>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1070 <soma@plt>
cmpl   $0x2,-0x10(%rbp)
jne    121f <main+0xbf>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <subtracao@plt>
cmpl   $0x3,-0x10(%rbp)
jne    1244 <main+0xe4>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1040 <divisaoA@plt>
cmpl   $0x4,-0x10(%rbp)
jne    1269 <main+0x109>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1050 <multi@plt>
jmp    126e <main+0x10e>
cmpl   $0x0,-0x10(%rbp)
jne    116f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe90(%rip),%rbx
lea    0x10(%rsp),%r13
lea    0xe9f(%rip),%rbp
lea    0xeb6(%rip),%r14
lea    0xe79(%rip),%r15
lea    0xc(%rsp),%r12
jmp    11b8 <main+0x48>
cs nopw 0x0(%rax,%rax,1)
test   %eax,%eax
je     12cc <main+0x15c>
lea    0xe41(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
lea    0xe41(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1090 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     1230 <main+0xc0>
cmp    $0x2,%eax
je     1256 <main+0xe6>
cmp    $0x3,%eax
je     127c <main+0x10c>
cmp    $0x4,%eax
jne    11b0 <main+0x40>
jmp    12a6 <main+0x136>
cs nopw 0x0(%rax,%rax,1)
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1080 <soma@plt>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
jne    1217 <main+0xa7>
lea    0xe62(%rip),%rdi
call   1030 <puts@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1070 <subtracao@plt>
mov    0xc(%rsp),%eax
cmp    $0x3,%eax
jne    121c <main+0xac>
lea    0xe2c(%rip),%rdi
call   1030 <puts@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1050 <divisaoA@plt>
mov    0xc(%rsp),%eax
cmp    $0x4,%eax
jne    11b0 <main+0x40>
lea    0xdec(%rip),%rdi
call   1030 <puts@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1060 <multi@plt>
mov    0xc(%rsp),%eax
jmp    11b0 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0ADigite um numero:\0A \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [22 x i8] c"Digite outro numero:\0A\00"
@.str.3 = [31 x i8] c"Escolha sua opera\C3\A7ao abaixo:\0A\00"
@.str.4 = [76 x i8] c"1 = soma\0A2 = subtra\C3\A7ao\0A3 = divisao\0A4 = multiplica\C3\A7ao\0A0 (zero) para sair!\0A\00"
@.str.5 = [3 x i8] c"%i\00"
@.str.6 = [14 x i8] c"Sua soma e: \0A\00"
@.str.7 = [20 x i8] c"Sua subtra\C3\A7ao e: \0A\00"
@.str.8 = [17 x i8] c"Sua divisao e: \0A\00"
@.str.9 = [23 x i8] c"Sua multplica\C3\A7ao e: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %45, %0
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%10 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %20
15: ; preds = %5
%16 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%17 = load float, float* %2
%18 = load float, float* %3
%19 = call i32 @soma(float %17, float %18)
br label %20
20: ; preds = %15, %5
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%25 = load float, float* %2
%26 = load float, float* %3
%27 = call i32 @subtracao(float %25, float %26)
br label %28
28: ; preds = %23, %20
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 3
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%33 = load float, float* %2
%34 = load float, float* %3
%35 = call i32 @divisaoA(float %33, float %34)
br label %36
36: ; preds = %31, %28
%37 = load i32, i32* %4
%38 = icmp eq i32 %37, 4
br i1 %38, label %39, label %44
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%41 = load float, float* %2
%42 = load float, float* %3
%43 = call i32 @multi(float %41, float %42)
br label %44
44: ; preds = %39, %36
br label %45
45: ; preds = %44
%46 = load i32, i32* %4
%47 = icmp ne i32 %46, 0
br i1 %47, label %5, label %48
48: ; preds = %45
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0ADigite um numero:\0A \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.5 = [3 x i8] c"%i\00"
@str = [21 x i8] c"Digite outro numero:\00"
@str.10 = [30 x i8] c"Escolha sua opera\C3\A7ao abaixo:\00"
@str.11 = [75 x i8] c"1 = soma\0A2 = subtra\C3\A7ao\0A3 = divisao\0A4 = multiplica\C3\A7ao\0A0 (zero) para sair!\00"
@str.12 = [22 x i8] c"Sua multplica\C3\A7ao e: \00"
@str.13 = [16 x i8] c"Sua divisao e: \00"
@str.14 = [19 x i8] c"Sua subtra\C3\A7ao e: \00"
@str.15 = [13 x i8] c"Sua soma e: \00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %50, %0
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.10, i64 0, i64 0))
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.11, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %23
17: ; preds = %7
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.15, i64 0, i64 0))
%19 = load float, float* %1
%20 = load float, float* %2
%21 = call i32 @soma(float %19, float %20)
%22 = load i32, i32* %3
br label %23
23: ; preds = %17, %7
%24 = phi i32 [ %22, %17 ], [ %15, %7 ]
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0))
%28 = load float, float* %1
%29 = load float, float* %2
%30 = call i32 @subtracao(float %28, float %29)
%31 = load i32, i32* %3
br label %32
32: ; preds = %26, %23
%33 = phi i32 [ %31, %26 ], [ %24, %23 ]
%34 = icmp eq i32 %33, 3
br i1 %34, label %35, label %41
35: ; preds = %32
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.13, i64 0, i64 0))
%37 = load float, float* %1
%38 = load float, float* %2
%39 = call i32 @divisaoA(float %37, float %38)
%40 = load i32, i32* %3
br label %41
41: ; preds = %35, %32
%42 = phi i32 [ %40, %35 ], [ %33, %32 ]
%43 = icmp eq i32 %42, 4
br i1 %43, label %44, label %50
44: ; preds = %41
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.12, i64 0, i64 0))
%46 = load float, float* %1
%47 = load float, float* %2
%48 = call i32 @multi(float %46, float %47)
%49 = load i32, i32* %3
br label %50
50: ; preds = %41, %44
%51 = phi i32 [ %42, %41 ], [ %49, %44 ]
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %7
53: ; preds = %50
ret i32 0
}