#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 */
struct gameState {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ discardCard(int, int, struct gameState *,
                               int /*<<< orphan*/);
int /*<<< orphan*/ drawCard(int, struct gameState *);
int playSmithy(struct gameState *state, int handPos, int currentPlayer) {
  int i;
  for (i = 0; i < 5; i++) {
    drawCard(currentPlayer, state);
  }
  discardCard(handPos, currentPlayer, state, 0);
  return 0;
}


x86 assembly (clang, -O0):
<playSmithy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    115d <playSmithy+0x3d>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <drawCard@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <playSmithy+0x19>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <discardCard@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<playSmithy>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %edx,%edi
mov    %rbp,%rsi
call   1040 <drawCard@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   1040 <drawCard@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   1040 <drawCard@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   1040 <drawCard@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   1040 <drawCard@plt>
mov    %r14d,%edi
mov    %ebx,%esi
mov    %rbp,%rdx
xor    %ecx,%ecx
call   1030 <discardCard@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.gameState = type { i32 }
define i32 @playSmithy(%struct.gameState* %0, i32 %1, i32 %2) {
%4 = alloca %struct.gameState*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store %struct.gameState* %0, %struct.gameState** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %15, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %6
%13 = load %struct.gameState*, %struct.gameState** %4
%14 = call i32 @drawCard(i32 %12, %struct.gameState* %13)
br label %15
15: ; preds = %11
%16 = load i32, i32* %7
%17 = add nsw i32 %16, 1
store i32 %17, i32* %7
br label %8
18: ; preds = %8
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = load %struct.gameState*, %struct.gameState** %4
%22 = call i32 @discardCard(i32 %19, i32 %20, %struct.gameState* %21, i32 0)
ret i32 0
}

LLVM IR (-O2):
%struct.gameState = type { i32 }
define i32 @playSmithy(%struct.gameState* %0, i32 %1, i32 %2) {
%4 = tail call i32 @drawCard(i32 %2, %struct.gameState* %0)
%5 = tail call i32 @drawCard(i32 %2, %struct.gameState* %0)
%6 = tail call i32 @drawCard(i32 %2, %struct.gameState* %0)
%7 = tail call i32 @drawCard(i32 %2, %struct.gameState* %0)
%8 = tail call i32 @drawCard(i32 %2, %struct.gameState* %0)
%9 = tail call i32 @discardCard(i32 %1, i32 %2, %struct.gameState* %0, i32 0)
ret i32 0
}