#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 */
short get_first_winning_move_3(int, int /*<<< orphan*/, int /*<<< orphan*/, int,
                               int, int, int, int);
int /*<<< orphan*/ printf(char *, short, short);
short test_get_first_winning_move_3() {
  short result, expected;
  short failed_test_count = 0;
  result = get_first_winning_move_3(9, 0, 0, 13, 24, 10, 15, 14);
  expected = 24;
  if (result != expected) {
    printf("\ntest_get_first_winning_move_3(): Expected %hi, got %hi for "
           "position (9, 0, 0, 13, 24, 10, 15, 14).",
           expected, result);
    failed_test_count++;
  }
  return failed_test_count;
}


x86 assembly (clang, -O0):
<test_get_first_winning_move_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movw   $0x0,-0x6(%rbp)
mov    $0x9,%edi
xor    %edx,%edx
mov    $0xd,%ecx
mov    $0x18,%r8d
mov    $0xa,%r9d
mov    %edx,%esi
movl   $0xf,(%rsp)
movl   $0xe,0x8(%rsp)
call   1040 <get_first_winning_move_3@plt>
mov    %ax,-0x2(%rbp)
movw   $0x18,-0x4(%rbp)
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
cmp    %ecx,%eax
je     1199 <test_get_first_winning_move_3+0x79>
mov    -0x4(%rbp),%ax
lea    0xe7f(%rip),%rdi
movswl %ax,%esi
movswl -0x2(%rbp),%edx
call   1030 <printf@plt>
mov    -0x6(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6(%rbp)
movswl -0x6(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_get_first_winning_move_3>:
push   %rbx
xor    %ebx,%ebx
mov    $0x9,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0xd,%ecx
mov    $0x18,%r8d
mov    $0xa,%r9d
push   $0xe
push   $0xf
call   1040 <get_first_winning_move_3@plt>
add    $0x10,%rsp
cmp    $0x18,%ax
je     1168 <test_get_first_winning_move_3+0x48>
movswl %ax,%edx
lea    0xea6(%rip),%rdi
mov    $0x18,%esi
call   1030 <printf@plt>
mov    $0x1,%bx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [100 x i8] c"\0Atest_get_first_winning_move_3(): Expected %hi, got %hi for position (9, 0, 0, 13, 24, 10, 15, 14).\00"
define signext i16 @test_get_first_winning_move_3() {
%1 = alloca i16
%2 = alloca i16
%3 = alloca i16
store i16 0, i16* %3
%4 = call signext i16 @get_first_winning_move_3(i32 9, i32 0, i32 0, i32 13, i32 24, i32 10, i32 15, i32 14)
store i16 %4, i16* %1
store i16 24, i16* %2
%5 = load i16, i16* %1
%6 = sext i16 %5 to i32
%7 = load i16, i16* %2
%8 = sext i16 %7 to i32
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %16
10: ; preds = %0
%11 = load i16, i16* %2
%12 = load i16, i16* %1
%13 = call i32 @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i16 signext %11, i16 signext %12)
%14 = load i16, i16* %3
%15 = add i16 %14, 1
store i16 %15, i16* %3
br label %16
16: ; preds = %10, %0
%17 = load i16, i16* %3
ret i16 %17
}

LLVM IR (-O2):
@.str = [100 x i8] c"\0Atest_get_first_winning_move_3(): Expected %hi, got %hi for position (9, 0, 0, 13, 24, 10, 15, 14).\00"
define signext i16 @test_get_first_winning_move_3() {
%1 = tail call signext i16 @get_first_winning_move_3(i32 9, i32 0, i32 0, i32 13, i32 24, i32 10, i32 15, i32 14)
%2 = icmp eq i16 %1, 24
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i16 signext 24, i16 signext %1)
br label %5
5: ; preds = %3, %0
%6 = phi i16 [ 1, %3 ], [ 0, %0 ]
ret i16 %6
}