#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*/ uint32_t;

/* Variables and functions */
float RAND_MAX;
scalar_t__ rand();
void Shuffle(uint32_t *Deck) {
  int r, i;
  uint32_t temp;
  for (i = 51; i >= 0; i--) {
    r = (int)(((float)rand()) / RAND_MAX * i);
    temp = Deck[i];
    Deck[i] = Deck[r];
    Deck[r] = temp;
  }
}


x86 assembly (clang, -O0):
<Shuffle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x33,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1194 <Shuffle+0x84>
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2ea8(%rip),%rax
divss  (%rax),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <Shuffle+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Shuffle>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x33,%ebx
mov    0x2ec4(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
divss  (%r15),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %ebx,%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%eax
mov    (%r14,%rbx,4),%ecx
cltq
mov    (%r14,%rax,4),%edx
mov    %edx,(%r14,%rbx,4)
mov    %ecx,(%r14,%rax,4)
add    $0xffffffffffffffff,%rbx
jb     1130 <Shuffle+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@RAND_MAX = global float 0.000000e+00
define void @Shuffle(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
store i32 51, i32* %4
br label %6
6: ; preds = %37, %1
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %40
9: ; preds = %6
%10 = call i64 (...) @rand()
%11 = sitofp i64 %10 to float
%12 = load float, float* @RAND_MAX
%13 = fdiv float %11, %12
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to float
%16 = fmul float %13, %15
%17 = fptosi float %16 to i32
store i32 %17, i32* %3
%18 = load i32*, i32** %2
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
store i32 %22, i32* %5
%23 = load i32*, i32** %2
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = load i32*, i32** %2
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 %27, i32* %31
%32 = load i32, i32* %5
%33 = load i32*, i32** %2
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
store i32 %32, i32* %36
br label %37
37: ; preds = %9
%38 = load i32, i32* %4
%39 = add nsw i32 %38, -1
store i32 %39, i32* %4
br label %6
40: ; preds = %6
ret void
}

LLVM IR (-O2):
@RAND_MAX = global float 0.000000e+00
define void @Shuffle(i32* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 51, %1 ], [ %17, %2 ]
%4 = tail call i64 (...) @rand()
%5 = sitofp i64 %4 to float
%6 = load float, float* @RAND_MAX
%7 = fdiv float %5, %6
%8 = trunc i64 %3 to i32
%9 = sitofp i32 %8 to float
%10 = fmul float %7, %9
%11 = fptosi float %10 to i32
%12 = getelementptr inbounds i32, i32* %0, i64 %3
%13 = load i32, i32* %12
%14 = sext i32 %11 to i64
%15 = getelementptr inbounds i32, i32* %0, i64 %14
%16 = load i32, i32* %15
store i32 %16, i32* %12
store i32 %13, i32* %15
%17 = add nsw i64 %3, -1
%18 = icmp eq i64 %3, 0
br i1 %18, label %19, label %2
19: ; preds = %2
ret void
}