#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int jogador1, jogador2;
  printf("Pedra (0), Papel (1), Tesoura (2): ");
  scanf("%d", &jogador1);
  printf("Pedra (0), Papel (1), Tesoura (2): ");
  scanf("%d", &jogador2);
  if (jogador1 > jogador2 || jogador1 == 0 && jogador2 == 2) {
    printf("Jogador1 venceu\n");
  } else if (jogador2 > jogador1 || jogador2 == 0 && jogador1 == 2) {
    printf("Jogador2 venceu\n");
  } else {
    printf("Empate\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1187 <main+0x67>
cmpl   $0x0,-0x8(%rbp)
jne    1198 <main+0x78>
cmpl   $0x2,-0xc(%rbp)
jne    1198 <main+0x78>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    11da <main+0xba>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11b8 <main+0x98>
cmpl   $0x0,-0xc(%rbp)
jne    11c9 <main+0xa9>
cmpl   $0x2,-0x8(%rbp)
jne    11c9 <main+0xa9>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
jmp    11d5 <main+0xb5>
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
jmp    11da <main+0xba>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
lea    0xeda(%rip),%r14
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
lea    0xec6(%rip),%rdi
cmp    %ecx,%eax
jg     11a9 <main+0x79>
test   %eax,%eax
jne    1185 <main+0x55>
cmp    $0x2,%ecx
je     11a9 <main+0x79>
cmp    %eax,%ecx
jle    1192 <main+0x62>
lea    0xe9e(%rip),%rdi
jmp    11a9 <main+0x79>
xor    $0x2,%eax
lea    0xe92(%rip),%rdx
lea    0xe84(%rip),%rdi
or     %eax,%ecx
cmove  %rdx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Pedra (0), Papel (1), Tesoura (2): \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [17 x i8] c"Jogador1 venceu\0A\00"
@.str.3 = [17 x i8] c"Jogador2 venceu\0A\00"
@.str.4 = [8 x i8] c"Empate\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = icmp sgt i32 %8, %9
br i1 %10, label %17, label %11
11: ; preds = %0
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %19
17: ; preds = %14, %0
%18 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %34
19: ; preds = %14, %11
%20 = load i32, i32* %3
%21 = load i32, i32* %2
%22 = icmp sgt i32 %20, %21
br i1 %22, label %29, label %23
23: ; preds = %19
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %31
29: ; preds = %26, %19
%30 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %33
31: ; preds = %26, %23
%32 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %33, %17
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"Pedra (0), Papel (1), Tesoura (2): \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [7 x i8] c"Empate\00"
@str.5 = [16 x i8] c"Jogador2 venceu\00"
@str.6 = [16 x i8] c"Jogador1 venceu\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %9, %10
br i1 %11, label %23, label %12
12: ; preds = %0
%13 = icmp eq i32 %9, 0
%14 = icmp eq i32 %10, 2
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %23, label %16
16: ; preds = %12
%17 = icmp sgt i32 %10, %9
br i1 %17, label %23, label %18
18: ; preds = %16
%19 = icmp eq i32 %10, 0
%20 = icmp eq i32 %9, 2
%21 = select i1 %19, i1 %20, i1 false
%22 = select i1 %21, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0)
br label %23
23: ; preds = %18, %16, %0, %12
%24 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.6, i64 0, i64 0), %12 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.6, i64 0, i64 0), %0 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.5, i64 0, i64 0), %16 ], [ %22, %18 ]
%25 = call i32 @puts(i8* dereferenceable(1) %24)
ret i32 0
}