#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 rand();
int /*<<< orphan*/ showcard(int);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  int deck[52];
  int c;
  for (int x = 0; x < 52; x++)
    deck[x] = 0;
  srand((unsigned)time(NULL));
  for (int x = 0; x < 5; x++) {
    for (;;) {
      c = rand() % 52;
      if (deck[c] == 0) {
        deck[c] = 1;
        showcard(c);
        break;
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xe8(%rbp)
cmpl   $0x34,-0xe8(%rbp)
jge    118f <main+0x4f>
movslq -0xe8(%rbp),%rax
movl   $0x0,-0xe0(%rbp,%rax,4)
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
jmp    115c <main+0x1c>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0xec(%rbp)
cmpl   $0x5,-0xec(%rbp)
jge    1225 <main+0xe5>
jmp    11bb <main+0x7b>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x34,%ecx
cltd
idiv   %ecx
mov    %edx,-0xe4(%rbp)
movslq -0xe4(%rbp),%rax
cmpl   $0x0,-0xe0(%rbp,%rax,4)
jne    1207 <main+0xc7>
movslq -0xe4(%rbp),%rax
movl   $0x1,-0xe0(%rbp,%rax,4)
mov    -0xe4(%rbp),%edi
call   1050 <showcard@plt>
jmp    120c <main+0xcc>
jmp    11bb <main+0x7b>
jmp    1211 <main+0xd1>
mov    -0xec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xec(%rbp)
jmp    11a9 <main+0x69>
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xd8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x34,%ecx,%ecx
sub    %ecx,%eax
movslq %eax,%rdi
cmpl   $0x0,(%rsp,%rdi,4)
jne    11b0 <main+0x70>
movl   $0x1,(%rsp,%rdi,4)
call   1050 <showcard@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x34,%ecx,%ecx
sub    %ecx,%eax
movslq %eax,%rdi
cmpl   $0x0,(%rsp,%rdi,4)
jne    11f0 <main+0xb0>
movl   $0x1,(%rsp,%rdi,4)
call   1050 <showcard@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x34,%ecx,%ecx
sub    %ecx,%eax
movslq %eax,%rdi
cmpl   $0x0,(%rsp,%rdi,4)
jne    1230 <main+0xf0>
movl   $0x1,(%rsp,%rdi,4)
call   1050 <showcard@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x34,%ecx,%ecx
sub    %ecx,%eax
movslq %eax,%rdi
cmpl   $0x0,(%rsp,%rdi,4)
jne    1270 <main+0x130>
movl   $0x1,(%rsp,%rdi,4)
call   1050 <showcard@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
movslq %eax,%rdi
imul   $0x4ec4ec4f,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x24,%rax
add    %ecx,%eax
imul   $0x34,%eax,%eax
sub    %eax,%edi
movslq %edi,%rax
cmpl   $0x0,(%rsp,%rax,4)
jne    12b0 <main+0x170>
call   1050 <showcard@plt>
xor    %eax,%eax
add    $0xd8,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [52 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 52
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [52 x i32], [52 x i32]* %2, i64 0, i64 %11
store i32 0, i32* %12
br label %13
13: ; preds = %9
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %6
16: ; preds = %6
%17 = call i64 @time(i32* null)
%18 = trunc i64 %17 to i32
%19 = call i32 @srand(i32 %18)
store i32 0, i32* %5
br label %20
20: ; preds = %40, %16
%21 = load i32, i32* %5
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %43
23: ; preds = %20
br label %24
24: ; preds = %38, %23
%25 = call i32 (...) @rand()
%26 = srem i32 %25, 52
store i32 %26, i32* %3
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [52 x i32], [52 x i32]* %2, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %24
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [52 x i32], [52 x i32]* %2, i64 0, i64 %34
store i32 1, i32* %35
%36 = load i32, i32* %3
%37 = call i32 @showcard(i32 %36)
br label %39
38: ; preds = %24
br label %24
39: ; preds = %32
br label %40
40: ; preds = %39
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %20
43: ; preds = %20
%44 = load i32, i32* %1
ret i32 %44
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [52 x i32]
%2 = bitcast [52 x i32]* %1 to i8*
%3 = tail call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @srand(i32 %4)
br label %6
6: ; preds = %0, %6
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 52
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6
%14 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 %9
store i32 1, i32* %14
%15 = tail call i32 @showcard(i32 %8)
br label %16
16: ; preds = %16, %13
%17 = tail call i32 (...) @rand()
%18 = srem i32 %17, 52
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %16
23: ; preds = %16
%24 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 %19
store i32 1, i32* %24
%25 = tail call i32 @showcard(i32 %18)
br label %26
26: ; preds = %26, %23
%27 = tail call i32 (...) @rand()
%28 = srem i32 %27, 52
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %26
33: ; preds = %26
%34 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 %29
store i32 1, i32* %34
%35 = tail call i32 @showcard(i32 %28)
br label %36
36: ; preds = %36, %33
%37 = tail call i32 (...) @rand()
%38 = srem i32 %37, 52
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %36
43: ; preds = %36
%44 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 %39
store i32 1, i32* %44
%45 = tail call i32 @showcard(i32 %38)
br label %46
46: ; preds = %46, %43
%47 = tail call i32 (...) @rand()
%48 = srem i32 %47, 52
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [52 x i32], [52 x i32]* %1, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %46
53: ; preds = %46
%54 = tail call i32 @showcard(i32 %48)
ret i32 0
}