#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_losing_move(int, int, int, int, int, int /*<<< orphan*/,
                            int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, short, short);
short test_get_first_losing_move() {
  short result, expected;
  short failed_test_count = 0;
  result = get_first_losing_move(1, 15, 10, 11, 16, 0, 0, 8);
  expected = 0;
  if (result != expected) {
    printf("\ntest_get_first_losing_move(): Expected %hi, got %hi for position "
           "(1, 15, 10, 11, 16, 0, 0, 8).",
           expected, result);
    failed_test_count++;
  }
  return failed_test_count;
}


x86 assembly (clang, -O0):
<test_get_first_losing_move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movw   $0x0,-0x6(%rbp)
mov    $0x1,%edi
mov    $0xf,%esi
mov    $0xa,%edx
mov    $0xb,%ecx
mov    $0x10,%r8d
xor    %r9d,%r9d
movl   $0x0,(%rsp)
movl   $0x8,0x8(%rsp)
call   1040 <get_first_losing_move@plt>
mov    %ax,-0x2(%rbp)
movw   $0x0,-0x4(%rbp)
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
cmp    %ecx,%eax
je     119c <test_get_first_losing_move+0x7c>
mov    -0x4(%rbp),%ax
lea    0xe7c(%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_losing_move>:
push   %rbx
xor    %ebx,%ebx
mov    $0x1,%edi
mov    $0xf,%esi
mov    $0xa,%edx
mov    $0xb,%ecx
mov    $0x10,%r8d
xor    %r9d,%r9d
push   $0x8
push   $0x0
call   1040 <get_first_losing_move@plt>
add    $0x10,%rsp
test   %ax,%ax
je     1167 <test_get_first_losing_move+0x47>
movswl %ax,%edx
lea    0xea4(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    $0x1,%bx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [96 x i8] c"\0Atest_get_first_losing_move(): Expected %hi, got %hi for position (1, 15, 10, 11, 16, 0, 0, 8).\00"
define signext i16 @test_get_first_losing_move() {
%1 = alloca i16
%2 = alloca i16
%3 = alloca i16
store i16 0, i16* %3
%4 = call signext i16 @get_first_losing_move(i32 1, i32 15, i32 10, i32 11, i32 16, i32 0, i32 0, i32 8)
store i16 %4, i16* %1
store i16 0, 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 ([96 x i8], [96 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 = [96 x i8] c"\0Atest_get_first_losing_move(): Expected %hi, got %hi for position (1, 15, 10, 11, 16, 0, 0, 8).\00"
define signext i16 @test_get_first_losing_move() {
%1 = tail call signext i16 @get_first_losing_move(i32 1, i32 15, i32 10, i32 11, i32 16, i32 0, i32 0, i32 8)
%2 = icmp eq i16 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0), i16 signext 0, i16 signext %1)
br label %5
5: ; preds = %3, %0
%6 = phi i16 [ 1, %3 ], [ 0, %0 ]
ret i16 %6
}