#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 entrada();
int /*<<< orphan*/ saida(int, int /*<<< orphan*/);
int show_menu() {
  int jogs = 0;
  while (jogs == 0) {
    saida(3, 0);
    saida(1, 0);
    jogs = entrada();
    if (jogs == 3) {
      jogs = 4;
    }
    if (jogs == 2) {
      saida(2, 0);
      jogs = entrada();
    }
  }
  return jogs;
}


x86 assembly (clang, -O0):
<show_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1191 <show_menu+0x71>
mov    $0x3,%edi
xor    %esi,%esi
call   1030 <saida@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <saida@plt>
mov    $0x0,%al
call   1040 <entrada@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
jne    116c <show_menu+0x4c>
movl   $0x4,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    118c <show_menu+0x6c>
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <saida@plt>
mov    $0x0,%al
call   1040 <entrada@plt>
mov    %eax,-0x4(%rbp)
jmp    112f <show_menu+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_menu>:
push   %rax
jmp    1134 <show_menu+0x14>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %eax,%eax
jne    118c <show_menu+0x6c>
mov    $0x3,%edi
xor    %esi,%esi
call   1030 <saida@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <saida@plt>
xor    %eax,%eax
call   1040 <entrada@plt>
mov    %eax,%ecx
mov    $0x4,%eax
cmp    $0x3,%ecx
jne    1170 <show_menu+0x50>
cmp    $0x2,%eax
jne    1130 <show_menu+0x10>
jmp    1177 <show_menu+0x57>
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,%eax
cmp    $0x2,%eax
jne    1130 <show_menu+0x10>
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <saida@plt>
xor    %eax,%eax
call   1040 <entrada@plt>
jmp    1130 <show_menu+0x10>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @show_menu() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %18, %0
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %19
5: ; preds = %2
%6 = call i32 @saida(i32 3, i32 0)
%7 = call i32 @saida(i32 1, i32 0)
%8 = call i32 (...) @entrada()
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %12
11: ; preds = %5
store i32 4, i32* %1
br label %12
12: ; preds = %11, %5
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 @saida(i32 2, i32 0)
%17 = call i32 (...) @entrada()
store i32 %17, i32* %1
br label %18
18: ; preds = %15, %12
br label %2
19: ; preds = %2
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
define i32 @show_menu() {
br label %1
1: ; preds = %0, %11
%2 = tail call i32 @saida(i32 3, i32 0)
%3 = tail call i32 @saida(i32 1, i32 0)
%4 = tail call i32 (...) @entrada()
%5 = icmp eq i32 %4, 3
%6 = select i1 %5, i32 4, i32 %4
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = tail call i32 @saida(i32 2, i32 0)
%10 = tail call i32 (...) @entrada()
br label %11
11: ; preds = %8, %1
%12 = phi i32 [ %10, %8 ], [ %6, %1 ]
%13 = icmp eq i32 %12, 0
br i1 %13, label %1, label %14
14: ; preds = %11
ret i32 %12
}