#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*/ calculo();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int x;
  calculo();
  printf("novo calculo (1-sim 2-nao)\n");
  scanf("%d", &x);
  while (1) {
    if (x == 1) {
      calculo();
      printf("novo calculo (1-sim 2-nao)\n");
      scanf("%d", &x);
    } else if (x == 2) {
      break;
    } else {
      printf("novo calculo (1-sim 2-nao)\n");
      scanf("%d", &x);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <calculo@plt>
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    118d <main+0x5d>
mov    $0x0,%al
call   1030 <calculo@plt>
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
jmp    11bd <main+0x8d>
cmpl   $0x2,-0x4(%rbp)
jne    119c <main+0x6c>
jmp    11c2 <main+0x92>
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6d(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
jmp    11bd <main+0x8d>
jmp    115b <main+0x2b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <calculo@plt>
lea    0xebc(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xeaa(%rip),%r15
lea    0xc(%rsp),%rbx
jmp    116f <main+0x3f>
nopl   (%rax)
xor    %eax,%eax
call   1040 <calculo@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
je     1160 <main+0x30>
cmp    $0x2,%eax
jne    1167 <main+0x37>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [28 x i8] c"novo calculo (1-sim 2-nao)\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca i32
%2 = call i32 (...) @calculo()
%3 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %5
5: ; preds = %0, %20
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = call i32 (...) @calculo()
%10 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %20
12: ; preds = %5
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %16
15: ; preds = %12
br label %21
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %19
19: ; preds = %16
br label %20
20: ; preds = %19, %8
br label %5
21: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str.3 = [27 x i8] c"novo calculo (1-sim 2-nao)\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @calculo()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.3, i64 0, i64 0))
br label %5
5: ; preds = %10, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
switch i32 %7, label %10 [
i32 1, label %8
i32 2, label %13
]
8: ; preds = %5
%9 = call i32 (...) @calculo()
br label %10
10: ; preds = %5, %8
%11 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.3, i64 0, i64 0), %5 ]
%12 = call i32 @puts(i8* dereferenceable(1) %11)
br label %5
13: ; preds = %5
ret void
}