#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 rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int n1, n2, v1, v2, v3, r1, r2, a1, a2, l1, l2, p1, p2, p3, c1, c2;
  int saldo;
  v3 = 0;
  p3 = 0;
  saldo = 100;
  printf("Jogo de Vinte e Um, (c) 2015\n");
  printf("============================\n");
  srand(time(NULL));
  while (saldo >= 5) {
    printf("Jogador 1.\n");
    printf("Seu saldo é R$ %i.\n", saldo);
    printf("carta 1.\n");
    v1 = rand() % 13 + 1;
    if (v1 > 10) {
      p1 = 10;
    } else if (v1 == 1) {
      printf("Carta vale 10? - 1 = SIM e 0 = NÃO\n");
      scanf("%d", &a2);
      if (a2 == 1)
        p1 = 10;
      else
        p1 = 1;
    } else {
      p1 = v1;
    }
    printf("%d\n", v1);
    printf("carta 2.\n");
    v2 = rand() % 13 + 1;
    if (v2 > 10) {
      p2 = 10;
    } else if (v2 == 1) {
      printf("Carta vale 10? - 1 = SIM e 0 = NÃO\n");
      scanf("%d", &a2);
      if (a2 == 1)
        p2 = 10;
      else
        p2 = 1;
    } else {
      p2 = v2;
    }
    printf("%d\n", v2);
    printf("Gostaria de uma terceira carta? \n 1- SIM, 0- NÃO\n");
    scanf("%d", &a1);
    if (a1 == 1) {
      v3 = rand() % 13 + 1;
      printf("Carta 3.\n");
      printf("%d\n", v3);
      if (v3 > 10) {
        p3 = 10;
      } else {
        p3 = v3;
      }
    }
    printf("Total Jogador 1\n");
    r1 = p1 + p2 + p3;
    printf("%d\n", r1);
    printf("Mesa.\n\n");
    printf("carta 1.\n");
    n1 = rand() % 13 + 1;
    if (n1 > 10) {
      c1 = 10;
    } else
      c1 = n1;
    printf("%d\n", n1);
    printf("carta 2.\n");
    n2 = rand() % 13 + 1;
    if (n2 > 10)
      c2 = 10;
    else
      c2 = n2;
    printf("%d\n", n2);
    printf("Total Mesa\n");
    r2 = c1 + c2;
    printf("%d\n", r2);
    if (r1 <= 21 && r2 <= 21) {
      if (r1 > r2) {
        printf("Jogador 1 Venceu\n");
        saldo = saldo + 5;
      } else {
        printf("Mesa Venceu\n");
        saldo = saldo - 5;
      }
    } else if (r1 > 21) {
      printf("Jogador perdeu\n");
      saldo = saldo - 5;
    } else if (r2 > 21) {
      printf("A mesa perdeu\n");
      saldo = saldo + 5;
    }
    int a3;
    printf("Quer continuar? 1 = SIM e 0 = NÃO\n");
    scanf("%d", &a3);
    if (a3 != 1)
      break;
  }
  printf("*FIM*\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x64,-0x48(%rbp)
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
cmpl   $0x5,-0x48(%rbp)
jl     1560 <main+0x410>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xd,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jle    1202 <main+0xb2>
movl   $0xa,-0x34(%rbp)
jmp    1257 <main+0x107>
cmpl   $0x1,-0x10(%rbp)
jne    124c <main+0xfc>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6b(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x1,-0x28(%rbp)
jne    1240 <main+0xf0>
movl   $0xa,-0x34(%rbp)
jmp    1247 <main+0xf7>
movl   $0x1,-0x34(%rbp)
jmp    1252 <main+0x102>
mov    -0x10(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    1257 <main+0x107>
mov    -0x10(%rbp),%esi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xd,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jle    12a1 <main+0x151>
movl   $0xa,-0x38(%rbp)
jmp    12f6 <main+0x1a6>
cmpl   $0x1,-0x14(%rbp)
jne    12eb <main+0x19b>
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdcc(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x1,-0x28(%rbp)
jne    12df <main+0x18f>
movl   $0xa,-0x38(%rbp)
jmp    12e6 <main+0x196>
movl   $0x1,-0x38(%rbp)
jmp    12f1 <main+0x1a1>
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    12f6 <main+0x1a6>
mov    -0x14(%rbp),%esi
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd70(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x1,-0x24(%rbp)
jne    1384 <main+0x234>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xd,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xa,-0x18(%rbp)
jle    1379 <main+0x229>
movl   $0xa,-0x3c(%rbp)
jmp    137f <main+0x22f>
mov    -0x18(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    1384 <main+0x234>
lea    0xd4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    -0x38(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xce7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xc99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xd,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jle    13f6 <main+0x2a6>
movl   $0xa,-0x40(%rbp)
jmp    13fc <main+0x2ac>
mov    -0x8(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x8(%rbp),%esi
lea    0xc89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xc7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xd,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jle    1446 <main+0x2f6>
movl   $0xa,-0x44(%rbp)
jmp    144c <main+0x2fc>
mov    -0xc(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0xc(%rbp),%esi
lea    0xc39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xc11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x15,-0x1c(%rbp)
jg     14dd <main+0x38d>
cmpl   $0x15,-0x20(%rbp)
jg     14dd <main+0x38d>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    14c1 <main+0x371>
lea    0xc53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x48(%rbp)
jmp    14d8 <main+0x388>
lea    0xc49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0x48(%rbp)
jmp    152e <main+0x3de>
cmpl   $0x15,-0x1c(%rbp)
jle    1503 <main+0x3b3>
lea    0xc30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
sub    $0x5,%eax
mov    %eax,-0x48(%rbp)
jmp    1529 <main+0x3d9>
cmpl   $0x15,-0x20(%rbp)
jle    1524 <main+0x3d4>
lea    0xc1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x48(%rbp)
jmp    1529 <main+0x3d9>
jmp    152e <main+0x3de>
lea    0xc08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xb49(%rip),%rdi
lea    -0x4c(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x1,-0x4c(%rbp)
je     155b <main+0x40b>
jmp    1560 <main+0x410>
jmp    11a0 <main+0x50>
lea    0xbfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%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    0xea7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x64,%r13d
lea    0xf0f(%rip),%r15
lea    0xe6d(%rip),%r14
movl   $0x0,0xc(%rsp)
jmp    1319 <main+0x1b9>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
add    %r15d,%r12d
add    0xc(%rsp),%r12d
mov    %rbx,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%r15
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
lea    (%rcx,%rdx,4),%ecx
mov    %eax,%edx
sub    %ecx,%edx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
cmp    $0xa,%edx
mov    %rbx,%r14
mov    $0xa,%ebx
cmovl  %esi,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
lea    (%rcx,%rdx,4),%ecx
mov    %eax,%edx
sub    %ecx,%edx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
cmp    $0xa,%edx
mov    $0xa,%ebp
cmovl  %esi,%ebp
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe28(%rip),%rdi
call   1030 <puts@plt>
add    %ebx,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %ebp,%r12d
lea    0xe48(%rip),%rdi
lea    0xe4d(%rip),%rax
cmovg  %rax,%rdi
mov    $0xfffffffb,%ebx
mov    $0x5,%eax
cmovg  %eax,%ebx
cmp    $0x16,%r12d
lea    0xe16(%rip),%rax
cmovge %rax,%rdi
mov    $0xfffffffb,%eax
cmovge %eax,%ebx
call   1030 <puts@plt>
add    %ebx,%r13d
lea    0xdd8(%rip),%rdi
call   1030 <puts@plt>
lea    0xd14(%rip),%r14
mov    %r14,%rdi
lea    0x10(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,0x10(%rsp)
jne    14e6 <main+0x386>
cmp    $0x5,%r13d
jl     14e6 <main+0x386>
lea    0xd32(%rip),%rdi
call   1030 <puts@plt>
lea    0xcca(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rcx
imul   $0x4ec4ec4f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
lea    (%rax,%rax,2),%edx
lea    (%rax,%rdx,4),%edx
mov    %ecx,%eax
sub    %edx,%eax
neg    %edx
lea    (%rcx,%rdx,1),%ebp
add    $0x1,%ebp
mov    $0xa,%r12d
mov    $0xa,%r15d
cmp    $0x9,%eax
jg     13c0 <main+0x260>
mov    %ebp,%r15d
test   %eax,%eax
jne    13c0 <main+0x260>
lea    0xd8e(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
cmpl   $0x1,0x8(%rsp)
sete   %al
lea    (%rax,%rax,8),%r15d
add    $0x1,%r15d
nopl   0x0(%rax,%rax,1)
lea    0xc51(%rip),%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xcdf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rcx
imul   $0x4ec4ec4f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
lea    (%rax,%rax,2),%edx
lea    (%rax,%rdx,4),%edx
mov    %ecx,%eax
sub    %edx,%eax
neg    %edx
lea    (%rcx,%rdx,1),%ebp
add    $0x1,%ebp
cmp    $0x9,%eax
jg     1450 <main+0x2f0>
mov    %ebp,%r12d
test   %eax,%eax
jne    1450 <main+0x2f0>
lea    0xd03(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
cmpl   $0x1,0x8(%rsp)
sete   %al
lea    (%rax,%rax,8),%r12d
add    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc04(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
lea    0x14(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x1,0x14(%rsp)
jne    11c0 <main+0x60>
xor    %eax,%eax
call   1080 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%edx
lea    (%rcx,%rdx,4),%ecx
mov    %eax,%ebx
sub    %ecx,%ebx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0x1,%ebp
lea    0xc66(%rip),%rdi
call   1030 <puts@plt>
lea    0xb56(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xa,%ebx
lea    0xb43(%rip),%rbx
mov    $0xa,%eax
cmovge %eax,%ebp
mov    %ebp,0xc(%rsp)
jmp    11c0 <main+0x60>
lea    0xb69(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Jogo de Vinte e Um, (c) 2015\0A\00"
@.str.1 = [30 x i8] c"============================\0A\00"
@.str.2 = [12 x i8] c"Jogador 1.\0A\00"
@.str.3 = [21 x i8] c"Seu saldo \C3\A9 R$ %i.\0A\00"
@.str.4 = [10 x i8] c"carta 1.\0A\00"
@.str.5 = [37 x i8] c"Carta vale 10? - 1 = SIM e 0 = N\C3\83O\0A\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [4 x i8] c"%d\0A\00"
@.str.8 = [10 x i8] c"carta 2.\0A\00"
@.str.9 = [51 x i8] c"Gostaria de uma terceira carta? \0A 1- SIM, 0- N\C3\83O\0A\00"
@.str.10 = [10 x i8] c"Carta 3.\0A\00"
@.str.11 = [17 x i8] c"Total Jogador 1\0A\00"
@.str.12 = [8 x i8] c"Mesa.\0A\0A\00"
@.str.13 = [12 x i8] c"Total Mesa\0A\00"
@.str.14 = [18 x i8] c"Jogador 1 Venceu\0A\00"
@.str.15 = [13 x i8] c"Mesa Venceu\0A\00"
@.str.16 = [16 x i8] c"Jogador perdeu\0A\00"
@.str.17 = [15 x i8] c"A mesa perdeu\0A\00"
@.str.18 = [36 x i8] c"Quer continuar? 1 = SIM e 0 = N\C3\83O\0A\00"
@.str.19 = [7 x i8] c"*FIM*\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
store i32 0, i32* %15
store i32 100, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 @time(i32* null)
%23 = call i32 @srand(i32 %22)
br label %24
24: ; preds = %176, %0
%25 = load i32, i32* %18
%26 = icmp sge i32 %25, 5
br i1 %26, label %27, label %177
27: ; preds = %24
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%29 = load i32, i32* %18
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%32 = call i32 (...) @rand()
%33 = srem i32 %32, 13
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
%35 = load i32, i32* %4
%36 = icmp sgt i32 %35, 10
br i1 %36, label %37, label %38
37: ; preds = %27
store i32 10, i32* %13
br label %52
38: ; preds = %27
%39 = load i32, i32* %4
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %49
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %10)
%44 = load i32, i32* %10
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %47
46: ; preds = %41
store i32 10, i32* %13
br label %48
47: ; preds = %41
store i32 1, i32* %13
br label %48
48: ; preds = %47, %46
br label %51
49: ; preds = %38
%50 = load i32, i32* %4
store i32 %50, i32* %13
br label %51
51: ; preds = %49, %48
br label %52
52: ; preds = %51, %37
%53 = load i32, i32* %4
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %53)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%56 = call i32 (...) @rand()
%57 = srem i32 %56, 13
%58 = add nsw i32 %57, 1
store i32 %58, i32* %5
%59 = load i32, i32* %5
%60 = icmp sgt i32 %59, 10
br i1 %60, label %61, label %62
61: ; preds = %52
store i32 10, i32* %14
br label %76
62: ; preds = %52
%63 = load i32, i32* %5
%64 = icmp eq i32 %63, 1
br i1 %64, label %65, label %73
65: ; preds = %62
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%67 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %10)
%68 = load i32, i32* %10
%69 = icmp eq i32 %68, 1
br i1 %69, label %70, label %71
70: ; preds = %65
store i32 10, i32* %14
br label %72
71: ; preds = %65
store i32 1, i32* %14
br label %72
72: ; preds = %71, %70
br label %75
73: ; preds = %62
%74 = load i32, i32* %5
store i32 %74, i32* %14
br label %75
75: ; preds = %73, %72
br label %76
76: ; preds = %75, %61
%77 = load i32, i32* %5
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %77)
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.9, i64 0, i64 0))
%80 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %9)
%81 = load i32, i32* %9
%82 = icmp eq i32 %81, 1
br i1 %82, label %83, label %96
83: ; preds = %76
%84 = call i32 (...) @rand()
%85 = srem i32 %84, 13
%86 = add nsw i32 %85, 1
store i32 %86, i32* %6
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0))
%88 = load i32, i32* %6
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %88)
%90 = load i32, i32* %6
%91 = icmp sgt i32 %90, 10
br i1 %91, label %92, label %93
92: ; preds = %83
store i32 10, i32* %15
br label %95
93: ; preds = %83
%94 = load i32, i32* %6
store i32 %94, i32* %15
br label %95
95: ; preds = %93, %92
br label %96
96: ; preds = %95, %76
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
%98 = load i32, i32* %13
%99 = load i32, i32* %14
%100 = add nsw i32 %98, %99
%101 = load i32, i32* %15
%102 = add nsw i32 %100, %101
store i32 %102, i32* %7
%103 = load i32, i32* %7
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %103)
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%107 = call i32 (...) @rand()
%108 = srem i32 %107, 13
%109 = add nsw i32 %108, 1
store i32 %109, i32* %2
%110 = load i32, i32* %2
%111 = icmp sgt i32 %110, 10
br i1 %111, label %112, label %113
112: ; preds = %96
store i32 10, i32* %16
br label %115
113: ; preds = %96
%114 = load i32, i32* %2
store i32 %114, i32* %16
br label %115
115: ; preds = %113, %112
%116 = load i32, i32* %2
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %116)
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%119 = call i32 (...) @rand()
%120 = srem i32 %119, 13
%121 = add nsw i32 %120, 1
store i32 %121, i32* %3
%122 = load i32, i32* %3
%123 = icmp sgt i32 %122, 10
br i1 %123, label %124, label %125
124: ; preds = %115
store i32 10, i32* %17
br label %127
125: ; preds = %115
%126 = load i32, i32* %3
store i32 %126, i32* %17
br label %127
127: ; preds = %125, %124
%128 = load i32, i32* %3
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %128)
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0))
%131 = load i32, i32* %16
%132 = load i32, i32* %17
%133 = add nsw i32 %131, %132
store i32 %133, i32* %8
%134 = load i32, i32* %8
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %134)
%136 = load i32, i32* %7
%137 = icmp sle i32 %136, 21
br i1 %137, label %138, label %154
138: ; preds = %127
%139 = load i32, i32* %8
%140 = icmp sle i32 %139, 21
br i1 %140, label %141, label %154
141: ; preds = %138
%142 = load i32, i32* %7
%143 = load i32, i32* %8
%144 = icmp sgt i32 %142, %143
br i1 %144, label %145, label %149
145: ; preds = %141
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0))
%147 = load i32, i32* %18
%148 = add nsw i32 %147, 5
store i32 %148, i32* %18
br label %153
149: ; preds = %141
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.15, i64 0, i64 0))
%151 = load i32, i32* %18
%152 = sub nsw i32 %151, 5
store i32 %152, i32* %18
br label %153
153: ; preds = %149, %145
br label %170
154: ; preds = %138, %127
%155 = load i32, i32* %7
%156 = icmp sgt i32 %155, 21
br i1 %156, label %157, label %161
157: ; preds = %154
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0))
%159 = load i32, i32* %18
%160 = sub nsw i32 %159, 5
store i32 %160, i32* %18
br label %169
161: ; preds = %154
%162 = load i32, i32* %8
%163 = icmp sgt i32 %162, 21
br i1 %163, label %164, label %168
164: ; preds = %161
%165 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0))
%166 = load i32, i32* %18
%167 = add nsw i32 %166, 5
store i32 %167, i32* %18
br label %168
168: ; preds = %164, %161
br label %169
169: ; preds = %168, %157
br label %170
170: ; preds = %169, %153
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.18, i64 0, i64 0))
%172 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %19)
%173 = load i32, i32* %19
%174 = icmp ne i32 %173, 1
br i1 %174, label %175, label %176
175: ; preds = %170
br label %177
176: ; preds = %170
br label %24
177: ; preds = %175, %24
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [21 x i8] c"Seu saldo \C3\A9 R$ %i.\0A\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [4 x i8] c"%d\0A\00"
@str = [29 x i8] c"Jogo de Vinte e Um, (c) 2015\00"
@str.20 = [29 x i8] c"============================\00"
@str.21 = [6 x i8] c"*FIM*\00"
@str.22 = [11 x i8] c"Jogador 1.\00"
@str.25 = [50 x i8] c"Gostaria de uma terceira carta? \0A 1- SIM, 0- N\C3\83O\00"
@str.26 = [16 x i8] c"Total Jogador 1\00"
@str.27 = [7 x i8] c"Mesa.\0A\00"
@str.28 = [9 x i8] c"carta 1.\00"
@str.29 = [9 x i8] c"carta 2.\00"
@str.30 = [11 x i8] c"Total Mesa\00"
@str.31 = [35 x i8] c"Quer continuar? 1 = SIM e 0 = N\C3\83O\00"
@str.32 = [15 x i8] c"Jogador perdeu\00"
@str.33 = [12 x i8] c"Mesa Venceu\00"
@str.34 = [17 x i8] c"Jogador 1 Venceu\00"
@str.35 = [9 x i8] c"Carta 3.\00"
@str.37 = [36 x i8] c"Carta vale 10? - 1 = SIM e 0 = N\C3\83O\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.20, i64 0, i64 0))
%8 = tail call i32 @time(i32* null)
%9 = tail call i32 @srand(i32 %8)
%10 = bitcast i32* %3 to i8*
br label %11
11: ; preds = %62, %0
%12 = phi i32 [ 0, %0 ], [ %63, %62 ]
%13 = phi i32 [ 100, %0 ], [ %93, %62 ]
%14 = icmp sgt i32 %13, 4
br i1 %14, label %15, label %98
15: ; preds = %11
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.22, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.28, i64 0, i64 0))
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 13
%21 = add nsw i32 %20, 1
%22 = icmp sgt i32 %20, 9
br i1 %22, label %31, label %23
23: ; preds = %15
%24 = icmp eq i32 %20, 0
br i1 %24, label %25, label %31
25: ; preds = %23
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.37, i64 0, i64 0))
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%28 = load i32, i32* %2
%29 = icmp eq i32 %28, 1
%30 = select i1 %29, i32 10, i32 1
br label %31
31: ; preds = %23, %25, %15
%32 = phi i32 [ 10, %15 ], [ %30, %25 ], [ %21, %23 ]
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %21)
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.29, i64 0, i64 0))
%35 = call i32 (...) @rand()
%36 = srem i32 %35, 13
%37 = add nsw i32 %36, 1
%38 = icmp sgt i32 %36, 9
br i1 %38, label %47, label %39
39: ; preds = %31
%40 = icmp eq i32 %36, 0
br i1 %40, label %41, label %47
41: ; preds = %39
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.37, i64 0, i64 0))
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%44 = load i32, i32* %2
%45 = icmp eq i32 %44, 1
%46 = select i1 %45, i32 10, i32 1
br label %47
47: ; preds = %39, %41, %31
%48 = phi i32 [ 10, %31 ], [ %46, %41 ], [ %37, %39 ]
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %37)
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.25, i64 0, i64 0))
%51 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%52 = load i32, i32* %1
%53 = icmp eq i32 %52, 1
br i1 %53, label %54, label %62
54: ; preds = %47
%55 = call i32 (...) @rand()
%56 = srem i32 %55, 13
%57 = add nsw i32 %56, 1
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.35, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %57)
%60 = icmp slt i32 %56, 10
%61 = select i1 %60, i32 %57, i32 10
br label %62
62: ; preds = %54, %47
%63 = phi i32 [ %12, %47 ], [ %61, %54 ]
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.26, i64 0, i64 0))
%65 = add nsw i32 %48, %32
%66 = add nsw i32 %65, %63
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %66)
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.27, i64 0, i64 0))
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.28, i64 0, i64 0))
%70 = call i32 (...) @rand()
%71 = srem i32 %70, 13
%72 = add nsw i32 %71, 1
%73 = icmp slt i32 %71, 10
%74 = select i1 %73, i32 %72, i32 10
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %72)
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.29, i64 0, i64 0))
%77 = call i32 (...) @rand()
%78 = srem i32 %77, 13
%79 = add nsw i32 %78, 1
%80 = icmp slt i32 %78, 10
%81 = select i1 %80, i32 %79, i32 10
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %79)
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.30, i64 0, i64 0))
%84 = add nsw i32 %81, %74
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %84)
%86 = icmp slt i32 %66, 22
%87 = icmp sgt i32 %66, %84
%88 = select i1 %87, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.34, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.33, i64 0, i64 0)
%89 = select i1 %86, i8* %88, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str.32, i64 0, i64 0)
%90 = and i1 %86, %87
%91 = select i1 %90, i32 5, i32 -5
%92 = call i32 @puts(i8* dereferenceable(1) %89)
%93 = add nsw i32 %13, %91
%94 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.31, i64 0, i64 0))
%95 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%96 = load i32, i32* %3
%97 = icmp eq i32 %96, 1
br i1 %97, label %11, label %98
98: ; preds = %62, %11
%99 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.21, i64 0, i64 0))
ret i32 0
}