#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 INT_MAX;
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int);
main() {
  int ran1, ran2;
  int die1, die2;
  int seed;
  printf("Enter an integer: ");
  scanf("%d", &seed);
  srand(seed);
  ran1 = rand();
  ran2 = rand();
  if (ran1 == INT_MAX)
    ran1--;
  if (ran2 == INT_MAX)
    ran2--;
  die1 = (int)(6.0 * ((float)ran1 / (float)INT_MAX) + 1);
  die2 = (int)(6.0 * ((float)ran2 / (float)INT_MAX) + 1);
  printf("You have rolled a %d and a %d.\n", die1, die2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e55(%rip),%rcx
cmp    (%rcx),%eax
jne    11a4 <main+0x64>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e3a(%rip),%rcx
cmp    (%rcx),%eax
jne    11bf <main+0x7f>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
mov    0x2e1d(%rip),%rax
cvtsi2ssl (%rax),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe21(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe1d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
mov    0x2de6(%rip),%rax
cvtsi2ssl (%rax),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdea(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xde6(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <rand@plt>
mov    0x2e64(%rip),%rcx
mov    (%rcx),%ecx
xor    %edx,%edx
cmp    %ecx,%ebx
sete   %dl
sub    %edx,%ebx
xor    %edx,%edx
cmp    %ecx,%eax
sete   %dl
sub    %edx,%eax
cvtsi2ss %ebx,%xmm0
cvtsi2ss %ecx,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe50(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xe4c(%rip),%xmm3
addsd  %xmm3,%xmm0
cvtsi2ss %eax,%xmm4
cvttsd2si %xmm0,%esi
divss  %xmm1,%xmm4
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
cvttsd2si %xmm0,%edx
lea    0xe40(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@INT_MAX = global i32 0
@.str.2 = [32 x i8] c"You have rolled a %d and a %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 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* %6)
%9 = load i32, i32* %6
%10 = call i32 @srand(i32 %9)
%11 = call i32 (...) @rand()
store i32 %11, i32* %2
%12 = call i32 (...) @rand()
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* @INT_MAX
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = load i32, i32* %2
%18 = add nsw i32 %17, -1
store i32 %18, i32* %2
br label %19
19: ; preds = %16, %0
%20 = load i32, i32* %3
%21 = load i32, i32* @INT_MAX
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %3
%25 = add nsw i32 %24, -1
store i32 %25, i32* %3
br label %26
26: ; preds = %23, %19
%27 = load i32, i32* %2
%28 = sitofp i32 %27 to float
%29 = load i32, i32* @INT_MAX
%30 = sitofp i32 %29 to float
%31 = fdiv float %28, %30
%32 = fpext float %31 to double
%33 = call double @llvm.fmuladd.f64(double 6.000000e+00, double %32, double 1.000000e+00)
%34 = fptosi double %33 to i32
store i32 %34, i32* %4
%35 = load i32, i32* %3
%36 = sitofp i32 %35 to float
%37 = load i32, i32* @INT_MAX
%38 = sitofp i32 %37 to float
%39 = fdiv float %36, %38
%40 = fpext float %39 to double
%41 = call double @llvm.fmuladd.f64(double 6.000000e+00, double %40, double 1.000000e+00)
%42 = fptosi double %41 to i32
store i32 %42, i32* %5
%43 = load i32, i32* %4
%44 = load i32, i32* %5
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %43, i32 %44)
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@INT_MAX = global i32 0
@.str.2 = [32 x i8] c"You have rolled a %d and a %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @srand(i32 %5)
%7 = call i32 (...) @rand()
%8 = call i32 (...) @rand()
%9 = load i32, i32* @INT_MAX
%10 = icmp eq i32 %7, %9
%11 = sext i1 %10 to i32
%12 = add nsw i32 %7, %11
%13 = icmp eq i32 %8, %9
%14 = sext i1 %13 to i32
%15 = add nsw i32 %8, %14
%16 = sitofp i32 %12 to float
%17 = sitofp i32 %9 to float
%18 = fdiv float %16, %17
%19 = fpext float %18 to double
%20 = call double @llvm.fmuladd.f64(double %19, double 6.000000e+00, double 1.000000e+00)
%21 = fptosi double %20 to i32
%22 = sitofp i32 %15 to float
%23 = fdiv float %22, %17
%24 = fpext float %23 to double
%25 = call double @llvm.fmuladd.f64(double %24, double 6.000000e+00, double 1.000000e+00)
%26 = fptosi double %25 to i32
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %21, i32 %26)
ret i32 0
}