#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 GetFromSave(int, char);
int log(int);
int /*<<< orphan*/ printf(char *, ...);
FinishHTML(int _userId, char winner[4]) {
  int cash = GetFromSave(_userId, 'c');
  int _round = GetFromSave(_userId, 'r');
  printf("%s%c%c\n", "Content-Type:text/html;charset=UTF-8", 13, 10);
  printf("<html lang=\"pt-BR\">");
  printf("<!DOCTYPE html>");
  printf("<html>");
  printf("<head>");
  printf("<title>End</title>");
  printf(
      "<link rel=\"stylesheet\" type=\"text/css\" href=\"/~743586/end.css\">");
  printf("</head>");
  printf("<body>");
  printf("<img "
         "src=\"http://blackmarket.rotran.io/images/"
         "LOL_LOGOSmallTransparent.png\">");
  if (_round >= (log(16) / log(2))) {
    printf("<h2>O campeonato chegou ao seu fim, com o time vitorioso sendo "
           "%s!<br> Muito obrigado pela sua presença.</h2>",
           winner);
  } else {
    printf("<h2>Ora ora, alguém aqui perdeu todo seu dinheiro para "
           "apostas...<br> Muito obrigado pela sua presença.</h2>");
  }
  if (cash >= 1000) {
    printf("<h3>Seu lucro foi de incríveis %d reais! Mim çina!</h3>",
           cash - 1000);
  } else {
    printf("<h3>Parabéns! Seu lucro foi de %d reais!..... Negativos.. :(</h3>",
           1000 - cash);
  }
  printf("<h1>Sua pontuação final foi de R$ %d</h4>", cash);
  printf("<img "
         "src=\"http://mypst.com.br/media/game/NPWR02631_00/full-icon.png\">");
  printf("</body>");
  printf("</html>");
}


x86 assembly (clang, -O0):
<FinishHTML>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x63,%esi
call   1050 <GetFromSave@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x72,%esi
call   1050 <GetFromSave@plt>
mov    %eax,-0x18(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9b(%rip),%rsi
mov    $0xd,%edx
mov    $0xa,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x10,%edi
call   1040 <log@plt>
mov    %eax,-0x20(%rbp)
mov    $0x2,%edi
call   1040 <log@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jl     1245 <FinishHTML+0x115>
mov    -0x10(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1253 <FinishHTML+0x123>
lea    0xf31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3e8,-0x14(%rbp)
jl     127c <FinishHTML+0x14c>
mov    -0x14(%rbp),%esi
sub    $0x3e8,%esi
lea    0xf7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1292 <FinishHTML+0x162>
mov    $0x3e8,%esi
sub    -0x14(%rbp),%esi
lea    0xf9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xfcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1023(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x101d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FinishHTML>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x63,%esi
call   1050 <GetFromSave@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0x72,%esi
call   1050 <GetFromSave@plt>
mov    %eax,%r15d
lea    0xea2(%rip),%rdi
lea    0xea3(%rip),%rsi
mov    $0xd,%edx
mov    $0xa,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x10,%edi
call   1040 <log@plt>
mov    %eax,%ebp
mov    $0x2,%edi
call   1040 <log@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
cmp    %eax,%r15d
jge    123c <FinishHTML+0x10c>
lea    0xf60(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x3e8,%ebx
jge    1255 <FinishHTML+0x125>
mov    $0x3e8,%esi
sub    %ebx,%esi
lea    0xfec(%rip),%rdi
jmp    1264 <FinishHTML+0x134>
lea    0xecb(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x3e8,%ebx
jl     122c <FinishHTML+0xfc>
mov    %ebx,%esi
add    $0xfffffc18,%esi
lea    0xf88(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xff7(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1013(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x104b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1045(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%s%c%c\0A\00"
@.str.1 = [37 x i8] c"Content-Type:text/html;charset=UTF-8\00"
@.str.2 = [20 x i8] c"<html lang=\22pt-BR\22>\00"
@.str.3 = [16 x i8] c"<!DOCTYPE html>\00"
@.str.4 = [7 x i8] c"<html>\00"
@.str.5 = [7 x i8] c"<head>\00"
@.str.6 = [19 x i8] c"<title>End</title>\00"
@.str.7 = [64 x i8] c"<link rel=\22stylesheet\22 type=\22text/css\22 href=\22/~743586/end.css\22>\00"
@.str.8 = [8 x i8] c"</head>\00"
@.str.9 = [7 x i8] c"<body>\00"
@.str.10 = [77 x i8] c"<img src=\22http://blackmarket.rotran.io/images/LOL_LOGOSmallTransparent.png\22>\00"
@.str.11 = [111 x i8] c"<h2>O campeonato chegou ao seu fim, com o time vitorioso sendo %s!<br> Muito obrigado pela sua presen\C3\A7a.</h2>\00"
@.str.12 = [111 x i8] c"<h2>Ora ora, algu\C3\A9m aqui perdeu todo seu dinheiro para apostas...<br> Muito obrigado pela sua presen\C3\A7a.</h2>\00"
@.str.13 = [58 x i8] c"<h3>Seu lucro foi de incr\C3\ADveis %d reais! Mim \C3\A7ina!</h3>\00"
@.str.14 = [67 x i8] c"<h3>Parab\C3\A9ns! Seu lucro foi de %d reais!..... Negativos.. :(</h3>\00"
@.str.15 = [44 x i8] c"<h1>Sua pontua\C3\A7\C3\A3o final foi de R$ %d</h4>\00"
@.str.16 = [70 x i8] c"<img src=\22http://mypst.com.br/media/game/NPWR02631_00/full-icon.png\22>\00"
@.str.17 = [8 x i8] c"</body>\00"
@.str.18 = [8 x i8] c"</html>\00"
define i32 @FinishHTML(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%8 = load i32, i32* %4
%9 = call i32 @GetFromSave(i32 %8, i8 signext 99)
store i32 %9, i32* %6
%10 = load i32, i32* %4
%11 = call i32 @GetFromSave(i32 %10, i8 signext 114)
store i32 %11, i32* %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 13, i32 10)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.7, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.10, i64 0, i64 0))
%22 = load i32, i32* %7
%23 = call i32 @log(i32 16)
%24 = call i32 @log(i32 2)
%25 = sdiv i32 %23, %24
%26 = icmp sge i32 %22, %25
br i1 %26, label %27, label %30
27: ; preds = %2
%28 = load i8*, i8** %5
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str.11, i64 0, i64 0), i8* %28)
br label %32
30: ; preds = %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str.12, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = load i32, i32* %6
%34 = icmp sge i32 %33, 1000
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = load i32, i32* %6
%37 = sub nsw i32 %36, 1000
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0), i32 %37)
br label %43
39: ; preds = %32
%40 = load i32, i32* %6
%41 = sub nsw i32 1000, %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.14, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %39, %35
%44 = load i32, i32* %6
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.15, i64 0, i64 0), i32 %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.16, i64 0, i64 0))
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s%c%c\0A\00"
@.str.1 = [37 x i8] c"Content-Type:text/html;charset=UTF-8\00"
@.str.2 = [20 x i8] c"<html lang=\22pt-BR\22>\00"
@.str.3 = [16 x i8] c"<!DOCTYPE html>\00"
@.str.4 = [7 x i8] c"<html>\00"
@.str.5 = [7 x i8] c"<head>\00"
@.str.6 = [19 x i8] c"<title>End</title>\00"
@.str.7 = [64 x i8] c"<link rel=\22stylesheet\22 type=\22text/css\22 href=\22/~743586/end.css\22>\00"
@.str.8 = [8 x i8] c"</head>\00"
@.str.9 = [7 x i8] c"<body>\00"
@.str.10 = [77 x i8] c"<img src=\22http://blackmarket.rotran.io/images/LOL_LOGOSmallTransparent.png\22>\00"
@.str.11 = [111 x i8] c"<h2>O campeonato chegou ao seu fim, com o time vitorioso sendo %s!<br> Muito obrigado pela sua presen\C3\A7a.</h2>\00"
@.str.12 = [111 x i8] c"<h2>Ora ora, algu\C3\A9m aqui perdeu todo seu dinheiro para apostas...<br> Muito obrigado pela sua presen\C3\A7a.</h2>\00"
@.str.13 = [58 x i8] c"<h3>Seu lucro foi de incr\C3\ADveis %d reais! Mim \C3\A7ina!</h3>\00"
@.str.14 = [67 x i8] c"<h3>Parab\C3\A9ns! Seu lucro foi de %d reais!..... Negativos.. :(</h3>\00"
@.str.15 = [44 x i8] c"<h1>Sua pontua\C3\A7\C3\A3o final foi de R$ %d</h4>\00"
@.str.16 = [70 x i8] c"<img src=\22http://mypst.com.br/media/game/NPWR02631_00/full-icon.png\22>\00"
@.str.17 = [8 x i8] c"</body>\00"
@.str.18 = [8 x i8] c"</html>\00"
define i32 @FinishHTML(i32 %0, i8* %1) {
%3 = tail call i32 @GetFromSave(i32 %0, i8 signext 99)
%4 = tail call i32 @GetFromSave(i32 %0, i8 signext 114)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 13, i32 10)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str.10, i64 0, i64 0))
%15 = tail call i32 @log(i32 16)
%16 = tail call i32 @log(i32 2)
%17 = sdiv i32 %15, %16
%18 = icmp slt i32 %4, %17
br i1 %18, label %21, label %19
19: ; preds = %2
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([111 x i8], [111 x i8]* @.str.11, i64 0, i64 0), i8* %1)
br label %23
21: ; preds = %2
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([111 x i8], [111 x i8]* @.str.12, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
%24 = icmp sgt i32 %3, 999
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = add nsw i32 %3, -1000
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0), i32 %26)
br label %31
28: ; preds = %23
%29 = sub nsw i32 1000, %3
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.14, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %25
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.15, i64 0, i64 0), i32 %3)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.16, i64 0, i64 0))
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
ret i32 undef
}