#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*/ menu();
int /*<<< orphan*/ printf(char *);
int read();
scalar_t__ scanf(char *, int *);
int /*<<< orphan*/ triangle(int);
int main() {
  int n = 0;
  int opt = 1;
  while (opt != 0) {
    menu();
    if (scanf("%d", &opt) == 0)
      break;
    if (opt == 1) {
      n = read();
      triangle(n);
    }
  }
  printf("La revedere!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11be <main+0x6e>
mov    $0x0,%al
call   1030 <menu@plt>
lea    0xe7b(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
cmp    $0x0,%rax
jne    119d <main+0x4d>
jmp    11be <main+0x6e>
cmpl   $0x1,-0xc(%rbp)
jne    11b9 <main+0x69>
mov    $0x0,%al
call   1060 <read@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <triangle@plt>
jmp    116d <main+0x1d>
lea    0xe3e(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x1,0x4(%rsp)
lea    0xe9d(%rip),%r14
lea    0x4(%rsp),%rbx
jmp    1174 <main+0x24>
nopw   0x0(%rax,%rax,1)
test   %eax,%eax
je     11a8 <main+0x58>
xor    %eax,%eax
call   1030 <menu@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
test   %rax,%rax
je     11a8 <main+0x58>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
jne    1170 <main+0x20>
xor    %eax,%eax
call   1060 <read@plt>
mov    %eax,%edi
call   1040 <triangle@plt>
mov    0x4(%rsp),%eax
jmp    1170 <main+0x20>
lea    0xe54(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"La revedere!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
br label %3
3: ; preds = %0, %14
%4 = call i32 (...) @menu()
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %17, label %7
7: ; preds = %3
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = call i32 (...) @read()
%12 = call i32 @triangle(i32 %11)
%13 = load i32, i32* %1
br label %14
14: ; preds = %10, %7
%15 = phi i32 [ %13, %10 ], [ %8, %7 ]
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %3
17: ; preds = %3, %14
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}