#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 */
typedef int /*<<< orphan*/ mpz_t;
typedef int /*<<< orphan*/ mpf_t;

/* Variables and functions */
int /*<<< orphan*/ AskForBonus(int *, int *, unsigned int *, unsigned int *,
                               int *);
int CalcMaxAcceptedRand(unsigned int);
int /*<<< orphan*/ DoPlayerRoll(long long *, unsigned int, unsigned int, int *);
int /*<<< orphan*/
PrintIfNeeded(int, int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
              int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
              int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
              int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
              int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
              int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ initRand();
int /*<<< orphan*/ mpf_clears(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/ *);
int /*<<< orphan*/ mpf_inits(int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/ *);
int /*<<< orphan*/ mpz_add_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_clears(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/ *);
int /*<<< orphan*/ mpz_inits(int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ mpz_set_str(int /*<<< orphan*/, char *, int);
int main(void) {
  initRand();
  int bonus = 0;
  int floatbonus = 0;
  unsigned int numberofdice = 0;
  unsigned int numberofsides = 0;
  int fastmode = 0;
  long long int player1roll = 0;
  long long int player2roll = 0;
  AskForBonus(&bonus, &floatbonus, &numberofdice, &numberofsides, &fastmode);
  mpz_t WinsWithBonus, LossesWithBonus, LoopCounter, LoopModuloFastmode,
      DrawCounter, NumberOfResults, FastmodeSkip;
  mpf_t RelativeBonusWins, RelativeBonusDraws, RelativeBonusLosses,
      RelativeBonusResults, RelativeBonusWinResults, RelativeBonusLossResults,
      WinsWithBonusFloat, LossesWithBonusFloat, LoopCounterFloat,
      NumberOfResultsFloat;
  mpz_inits(WinsWithBonus, LossesWithBonus, LoopCounter, LoopModuloFastmode,
            DrawCounter, NumberOfResults, FastmodeSkip, NULL);
  mpf_inits(RelativeBonusWins, RelativeBonusDraws, RelativeBonusLosses,
            RelativeBonusResults, RelativeBonusWinResults,
            RelativeBonusLossResults, WinsWithBonusFloat, LossesWithBonusFloat,
            LoopCounterFloat, NumberOfResultsFloat, NULL);
  mpz_set_str(FastmodeSkip,
              "100"
              "000"
              "000",
              10);
  int MaxAcceptedRand;
  MaxAcceptedRand = CalcMaxAcceptedRand(numberofsides);
  while (1) {
    player1roll = 0;
    player2roll = 0;
    DoPlayerRoll(&player1roll, numberofdice, numberofsides, &MaxAcceptedRand);
    DoPlayerRoll(&player2roll, numberofdice, numberofsides, &MaxAcceptedRand);
    if ((player1roll + bonus) > player2roll) {
      mpz_add_ui(WinsWithBonus, WinsWithBonus, 1);
    } else if ((player1roll + bonus) < player2roll) {
      mpz_add_ui(LossesWithBonus, LossesWithBonus, 1);
    } else {
      if (floatbonus == 1) {
        mpz_add_ui(WinsWithBonus, WinsWithBonus, 1);
      } else {
        mpz_add_ui(DrawCounter, DrawCounter, 1);
      }
    }
    mpz_add_ui(LoopCounter, LoopCounter, 1);
    PrintIfNeeded(fastmode, WinsWithBonus, LossesWithBonus, LoopCounter,
                  LoopModuloFastmode, DrawCounter, NumberOfResults,
                  FastmodeSkip, RelativeBonusWins, RelativeBonusDraws,
                  RelativeBonusLosses, RelativeBonusResults,
                  RelativeBonusWinResults, RelativeBonusLossResults,
                  WinsWithBonusFloat, LossesWithBonusFloat, LoopCounterFloat,
                  NumberOfResultsFloat);
  }
  mpz_clears(WinsWithBonus, LossesWithBonus, LoopCounter, LoopModuloFastmode,
             DrawCounter, NumberOfResults, NULL);
  mpf_clears(RelativeBonusWins, RelativeBonusDraws, RelativeBonusLosses,
             RelativeBonusResults, RelativeBonusWinResults,
             RelativeBonusLossResults, WinsWithBonusFloat, LossesWithBonusFloat,
             LoopCounterFloat, NumberOfResultsFloat, NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
movl   $0x0,-0x2c(%rbp)
mov    $0x0,%al
call   1080 <initRand@plt>
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x34(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x3c(%rbp),%rcx
lea    -0x40(%rbp),%r8
call   1050 <AskForBonus@plt>
mov    -0x54(%rbp),%edi
mov    -0x58(%rbp),%esi
mov    -0x5c(%rbp),%edx
mov    -0x60(%rbp),%ecx
mov    -0x64(%rbp),%r8d
mov    -0x68(%rbp),%r9d
mov    -0x6c(%rbp),%eax
xor    %r10d,%r10d
mov    %eax,(%rsp)
movq   $0x0,0x8(%rsp)
call   1090 <mpz_inits@plt>
mov    -0x70(%rbp),%edi
mov    -0x74(%rbp),%esi
mov    -0x78(%rbp),%edx
mov    -0x7c(%rbp),%ecx
mov    -0x80(%rbp),%r8d
mov    -0x84(%rbp),%r9d
mov    -0x88(%rbp),%ebx
mov    -0x8c(%rbp),%r11d
mov    -0x90(%rbp),%r10d
mov    -0x94(%rbp),%eax
xor    %r14d,%r14d
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movq   $0x0,0x20(%rsp)
call   1040 <mpf_inits@plt>
mov    -0x6c(%rbp),%edi
lea    0xd7a(%rip),%rsi
mov    $0xa,%edx
call   10b0 <mpz_set_str@plt>
mov    -0x3c(%rbp),%edi
call   1030 <CalcMaxAcceptedRand@plt>
mov    %eax,-0x98(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
lea    -0x48(%rbp),%rdi
lea    -0x98(%rbp),%rcx
call   1070 <DoPlayerRoll@plt>
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
lea    -0x50(%rbp),%rdi
lea    -0x98(%rbp),%rcx
call   1070 <DoPlayerRoll@plt>
mov    -0x48(%rbp),%rax
movslq -0x30(%rbp),%rcx
add    %rcx,%rax
cmp    -0x50(%rbp),%rax
jle    1304 <main+0x174>
mov    -0x54(%rbp),%edi
mov    -0x54(%rbp),%esi
mov    $0x1,%edx
call   1060 <mpz_add_ui@plt>
jmp    1367 <main+0x1d7>
mov    -0x48(%rbp),%rax
movslq -0x30(%rbp),%rcx
add    %rcx,%rax
cmp    -0x50(%rbp),%rax
jge    132e <main+0x19e>
mov    -0x58(%rbp),%edi
mov    -0x58(%rbp),%esi
mov    $0x1,%edx
call   1060 <mpz_add_ui@plt>
jmp    1362 <main+0x1d2>
cmpl   $0x1,-0x34(%rbp)
jne    134d <main+0x1bd>
mov    -0x54(%rbp),%edi
mov    -0x54(%rbp),%esi
mov    $0x1,%edx
call   1060 <mpz_add_ui@plt>
jmp    135d <main+0x1cd>
mov    -0x64(%rbp),%edi
mov    -0x64(%rbp),%esi
mov    $0x1,%edx
call   1060 <mpz_add_ui@plt>
jmp    1362 <main+0x1d2>
jmp    1367 <main+0x1d7>
mov    -0x5c(%rbp),%edi
mov    -0x5c(%rbp),%esi
mov    $0x1,%edx
call   1060 <mpz_add_ui@plt>
mov    -0x40(%rbp),%edi
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%edx
mov    -0x5c(%rbp),%ecx
mov    -0x60(%rbp),%r8d
mov    -0x64(%rbp),%r9d
mov    -0x68(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    -0x6c(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0x70(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x74(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0x78(%rbp),%r13d
mov    -0x7c(%rbp),%r12d
mov    -0x80(%rbp),%r15d
mov    -0x84(%rbp),%r14d
mov    -0x88(%rbp),%ebx
mov    -0x8c(%rbp),%r11d
mov    -0x90(%rbp),%r10d
mov    -0x94(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0xac(%rbp),%eax
mov    %eax,(%rsp)
mov    -0xa8(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0xa4(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0xa0(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    -0x9c(%rbp),%eax
mov    %r13d,0x20(%rsp)
mov    %r12d,0x28(%rsp)
mov    %r15d,0x30(%rsp)
mov    %r14d,0x38(%rsp)
mov    %ebx,0x40(%rsp)
mov    %r11d,0x48(%rsp)
mov    %r10d,0x50(%rsp)
mov    %eax,0x58(%rsp)
call   10a0 <PrintIfNeeded@plt>
jmp    129e <main+0x10e>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
xor    %eax,%eax
call   1080 <initRand@plt>
movl   $0x0,0x7c(%rsp)
movl   $0x0,0x78(%rsp)
movl   $0x0,0x6c(%rsp)
movl   $0x0,0x68(%rsp)
movl   $0x0,0x70(%rsp)
lea    0x7c(%rsp),%rdi
lea    0x78(%rsp),%rsi
lea    0x6c(%rsp),%rdx
lea    0x68(%rsp),%rcx
lea    0x70(%rsp),%r8
call   1050 <AskForBonus@plt>
movq   $0x0,0x8(%rsp)
call   1090 <mpz_inits@plt>
movq   $0x0,0x20(%rsp)
call   1040 <mpf_inits@plt>
lea    0xdf4(%rip),%rsi
mov    $0xa,%edx
call   10b0 <mpz_set_str@plt>
mov    0x68(%rsp),%edi
call   1030 <CalcMaxAcceptedRand@plt>
mov    %eax,0x74(%rsp)
lea    0x88(%rsp),%r14
lea    0x74(%rsp),%rbx
lea    0x80(%rsp),%r15
nopl   0x0(%rax,%rax,1)
movq   $0x0,0x88(%rsp)
movq   $0x0,0x80(%rsp)
mov    0x6c(%rsp),%esi
mov    0x68(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rcx
call   1070 <DoPlayerRoll@plt>
mov    0x6c(%rsp),%esi
mov    0x68(%rsp),%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1070 <DoPlayerRoll@plt>
mov    $0x1,%edx
call   1060 <mpz_add_ui@plt>
mov    $0x1,%edx
call   1060 <mpz_add_ui@plt>
mov    0x70(%rsp),%edi
call   10a0 <PrintIfNeeded@plt>
jmp    1240 <main+0xb0>

LLVM IR (-O0):
@.str = [10 x i8] c"100000000\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
%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
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i32 0, i32* %1
%27 = call i32 (...) @initRand()
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i64 0, i64* %7
store i64 0, i64* %8
%28 = call i32 @AskForBonus(i32* %2, i32* %3, i32* %4, i32* %5, i32* %6)
%29 = load i32, i32* %9
%30 = load i32, i32* %10
%31 = load i32, i32* %11
%32 = load i32, i32* %12
%33 = load i32, i32* %13
%34 = load i32, i32* %14
%35 = load i32, i32* %15
%36 = call i32 @mpz_inits(i32 %29, i32 %30, i32 %31, i32 %32, i32 %33, i32 %34, i32 %35, i32* null)
%37 = load i32, i32* %16
%38 = load i32, i32* %17
%39 = load i32, i32* %18
%40 = load i32, i32* %19
%41 = load i32, i32* %20
%42 = load i32, i32* %21
%43 = load i32, i32* %22
%44 = load i32, i32* %23
%45 = load i32, i32* %24
%46 = load i32, i32* %25
%47 = call i32 @mpf_inits(i32 %37, i32 %38, i32 %39, i32 %40, i32 %41, i32 %42, i32 %43, i32 %44, i32 %45, i32 %46, i32* null)
%48 = load i32, i32* %15
%49 = call i32 @mpz_set_str(i32 %48, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10)
%50 = load i32, i32* %5
%51 = call i32 @CalcMaxAcceptedRand(i32 %50)
store i32 %51, i32* %26
br label %52
52: ; preds = %0, %93
store i64 0, i64* %7
store i64 0, i64* %8
%53 = load i32, i32* %4
%54 = load i32, i32* %5
%55 = call i32 @DoPlayerRoll(i64* %7, i32 %53, i32 %54, i32* %26)
%56 = load i32, i32* %4
%57 = load i32, i32* %5
%58 = call i32 @DoPlayerRoll(i64* %8, i32 %56, i32 %57, i32* %26)
%59 = load i64, i64* %7
%60 = load i32, i32* %2
%61 = sext i32 %60 to i64
%62 = add nsw i64 %59, %61
%63 = load i64, i64* %8
%64 = icmp sgt i64 %62, %63
br i1 %64, label %65, label %69
65: ; preds = %52
%66 = load i32, i32* %9
%67 = load i32, i32* %9
%68 = call i32 @mpz_add_ui(i32 %66, i32 %67, i32 1)
br label %93
69: ; preds = %52
%70 = load i64, i64* %7
%71 = load i32, i32* %2
%72 = sext i32 %71 to i64
%73 = add nsw i64 %70, %72
%74 = load i64, i64* %8
%75 = icmp slt i64 %73, %74
br i1 %75, label %76, label %80
76: ; preds = %69
%77 = load i32, i32* %10
%78 = load i32, i32* %10
%79 = call i32 @mpz_add_ui(i32 %77, i32 %78, i32 1)
br label %92
80: ; preds = %69
%81 = load i32, i32* %3
%82 = icmp eq i32 %81, 1
br i1 %82, label %83, label %87
83: ; preds = %80
%84 = load i32, i32* %9
%85 = load i32, i32* %9
%86 = call i32 @mpz_add_ui(i32 %84, i32 %85, i32 1)
br label %91
87: ; preds = %80
%88 = load i32, i32* %13
%89 = load i32, i32* %13
%90 = call i32 @mpz_add_ui(i32 %88, i32 %89, i32 1)
br label %91
91: ; preds = %87, %83
br label %92
92: ; preds = %91, %76
br label %93
93: ; preds = %92, %65
%94 = load i32, i32* %11
%95 = load i32, i32* %11
%96 = call i32 @mpz_add_ui(i32 %94, i32 %95, i32 1)
%97 = load i32, i32* %6
%98 = load i32, i32* %9
%99 = load i32, i32* %10
%100 = load i32, i32* %11
%101 = load i32, i32* %12
%102 = load i32, i32* %13
%103 = load i32, i32* %14
%104 = load i32, i32* %15
%105 = load i32, i32* %16
%106 = load i32, i32* %17
%107 = load i32, i32* %18
%108 = load i32, i32* %19
%109 = load i32, i32* %20
%110 = load i32, i32* %21
%111 = load i32, i32* %22
%112 = load i32, i32* %23
%113 = load i32, i32* %24
%114 = load i32, i32* %25
%115 = call i32 @PrintIfNeeded(i32 %97, i32 %98, i32 %99, i32 %100, i32 %101, i32 %102, i32 %103, i32 %104, i32 %105, i32 %106, i32 %107, i32 %108, i32 %109, i32 %110, i32 %111, i32 %112, i32 %113, i32 %114)
br label %52
}

LLVM IR (-O2):
@.str = [10 x i8] c"100000000\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = tail call i32 (...) @initRand()
%10 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%11 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%12 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%13 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%14 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%15 = bitcast i64* %6 to i8*
%16 = bitcast i64* %7 to i8*
%17 = call i32 @AskForBonus(i32* %1, i32* %2, i32* %3, i32* %4, i32* %5)
%18 = call i32 @mpz_inits(i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32* null)
%19 = call i32 @mpf_inits(i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32* null)
%20 = call i32 @mpz_set_str(i32 undef, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10)
%21 = bitcast i32* %8 to i8*
%22 = load i32, i32* %4
%23 = call i32 @CalcMaxAcceptedRand(i32 %22)
store i32 %23, i32* %8
br label %24
24: ; preds = %24, %0
store i64 0, i64* %6
store i64 0, i64* %7
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = call i32 @DoPlayerRoll(i64* %6, i32 %25, i32 %26, i32* %8)
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = call i32 @DoPlayerRoll(i64* %7, i32 %28, i32 %29, i32* %8)
%31 = call i32 @mpz_add_ui(i32 undef, i32 undef, i32 1)
%32 = call i32 @mpz_add_ui(i32 undef, i32 undef, i32 1)
%33 = load i32, i32* %5
%34 = call i32 @PrintIfNeeded(i32 %33, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef)
br label %24
}