#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 /*<<< orphan*/ init();
int /*<<< orphan*/ initDeck(int *, int);
int /*<<< orphan*/ overhandShuffle(int *, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ riffleShuffle(int *, int, int);
int /*<<< orphan*/ writeDeck(int *, int);
int main() {
  int deck[20];
  init();
  printf("Riffle shuffle\n");
  initDeck(deck, 20);
  writeDeck(deck, 20);
  printf("\n");
  riffleShuffle(deck, 20, 10);
  writeDeck(deck, 20);
  printf("\n\n");
  printf("Riffle shuffle\n");
  initDeck(deck, 20);
  writeDeck(deck, 20);
  printf("\n");
  riffleShuffle(deck, 20, 1);
  writeDeck(deck, 20);
  printf("\n\n");
  printf("Overhand shuffle\n");
  initDeck(deck, 20);
  writeDeck(deck, 20);
  printf("\n");
  overhandShuffle(deck, 20, 10);
  writeDeck(deck, 20);
  printf("\n\n");
  printf("Overhand shuffle\n");
  initDeck(deck, 20);
  writeDeck(deck, 20);
  printf("\n");
  overhandShuffle(deck, 20, 1);
  writeDeck(deck, 20);
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <init@plt>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1070 <initDeck@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1080 <writeDeck@plt>
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
mov    $0xa,%edx
call   1050 <riffleShuffle@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1080 <writeDeck@plt>
lea    0xe3e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1070 <initDeck@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1080 <writeDeck@plt>
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
call   1050 <riffleShuffle@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1080 <writeDeck@plt>
lea    0xddd(%rip),%rdi
call   1040 <printf@plt>
lea    0xdd4(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1070 <initDeck@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1080 <writeDeck@plt>
lea    0xdaa(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
mov    $0xa,%edx
call   1030 <overhandShuffle@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1080 <writeDeck@plt>
lea    0xd7c(%rip),%rdi
call   1040 <printf@plt>
lea    0xd73(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1070 <initDeck@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1080 <writeDeck@plt>
lea    0xd49(%rip),%rdi
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
call   1030 <overhandShuffle@plt>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1080 <writeDeck@plt>
lea    0xd1b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
xor    %eax,%eax
call   1070 <init@plt>
lea    0xe79(%rip),%r15
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x14,%esi
call   1080 <initDeck@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1090 <writeDeck@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0xa,%edx
call   1060 <riffleShuffle@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1090 <writeDeck@plt>
lea    0xe44(%rip),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1080 <initDeck@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1090 <writeDeck@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0x1,%edx
call   1060 <riffleShuffle@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1090 <writeDeck@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xdd1(%rip),%r15
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1080 <initDeck@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1090 <writeDeck@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0xa,%edx
call   1050 <overhandShuffle@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1090 <writeDeck@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1080 <initDeck@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1090 <writeDeck@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0x1,%edx
call   1050 <overhandShuffle@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1090 <writeDeck@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Riffle shuffle\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [3 x i8] c"\0A\0A\00"
@.str.3 = [18 x i8] c"Overhand shuffle\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i32]
store i32 0, i32* %1
%3 = call i32 (...) @init()
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%6 = call i32 @initDeck(i32* %5, i32 20)
%7 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%8 = call i32 @writeDeck(i32* %7, i32 20)
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%11 = call i32 @riffleShuffle(i32* %10, i32 20, i32 10)
%12 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%13 = call i32 @writeDeck(i32* %12, i32 20)
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%17 = call i32 @initDeck(i32* %16, i32 20)
%18 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%19 = call i32 @writeDeck(i32* %18, i32 20)
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%22 = call i32 @riffleShuffle(i32* %21, i32 20, i32 1)
%23 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%24 = call i32 @writeDeck(i32* %23, i32 20)
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%27 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%28 = call i32 @initDeck(i32* %27, i32 20)
%29 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%30 = call i32 @writeDeck(i32* %29, i32 20)
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%33 = call i32 @overhandShuffle(i32* %32, i32 20, i32 10)
%34 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%35 = call i32 @writeDeck(i32* %34, i32 20)
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%37 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%38 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%39 = call i32 @initDeck(i32* %38, i32 20)
%40 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%41 = call i32 @writeDeck(i32* %40, i32 20)
%42 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%43 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%44 = call i32 @overhandShuffle(i32* %43, i32 20, i32 1)
%45 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%46 = call i32 @writeDeck(i32* %45, i32 20)
%47 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str.5 = [15 x i8] c"Riffle shuffle\00"
@str.9 = [17 x i8] c"Overhand shuffle\00"
@str.10 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [20 x i32]
%2 = bitcast [20 x i32]* %1 to i8*
%3 = tail call i32 (...) @init()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%6 = call i32 @initDeck(i32* %5, i32 20)
%7 = call i32 @writeDeck(i32* %5, i32 20)
%8 = call i32 @putchar(i32 10)
%9 = call i32 @riffleShuffle(i32* %5, i32 20, i32 10)
%10 = call i32 @writeDeck(i32* %5, i32 20)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%13 = call i32 @initDeck(i32* %5, i32 20)
%14 = call i32 @writeDeck(i32* %5, i32 20)
%15 = call i32 @putchar(i32 10)
%16 = call i32 @riffleShuffle(i32* %5, i32 20, i32 1)
%17 = call i32 @writeDeck(i32* %5, i32 20)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
%20 = call i32 @initDeck(i32* %5, i32 20)
%21 = call i32 @writeDeck(i32* %5, i32 20)
%22 = call i32 @putchar(i32 10)
%23 = call i32 @overhandShuffle(i32* %5, i32 20, i32 10)
%24 = call i32 @writeDeck(i32* %5, i32 20)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
%27 = call i32 @initDeck(i32* %5, i32 20)
%28 = call i32 @writeDeck(i32* %5, i32 20)
%29 = call i32 @putchar(i32 10)
%30 = call i32 @overhandShuffle(i32* %5, i32 20, i32 1)
%31 = call i32 @writeDeck(i32* %5, i32 20)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}