#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*/ printf(char *, ...);
scalar_t__ valid_move_test_BITTEST();
scalar_t__ valid_move_test_SIMPLE();
int main() {
  int pass = 0;
  printf("Beginning tests...\n");
  printf("valid_move_test_SIMPLE"
         " ... ");
  if (valid_move_test_SIMPLE() == 0) {
    printf("PASS\n");
  } else {
    printf("FAIL\n");
    pass = 1;
  };
  printf("valid_move_test_BITTEST"
         " ... ");
  if (valid_move_test_BITTEST() == 0) {
    printf("PASS\n");
  } else {
    printf("FAIL\n");
    pass = 1;
  };
  printf("Tests finished: %s\n", pass == 0 ? "PASS" : "FAIL");
  return pass;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <valid_move_test_SIMPLE@plt>
cmp    $0x0,%rax
jne    1186 <main+0x56>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    119b <main+0x6b>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <valid_move_test_BITTEST@plt>
cmp    $0x0,%rax
jne    11cd <main+0x9d>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e2 <main+0xb2>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
lea    0xe86(%rip),%rsi
lea    0xe7a(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeff(%rip),%rdi
call   1040 <puts@plt>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <valid_move_test_SIMPLE@plt>
mov    %rax,%r15
test   %rax,%rax
lea    0xef0(%rip),%r14
lea    0xee4(%rip),%rbx
mov    %rbx,%rdi
cmove  %r14,%rdi
call   1040 <puts@plt>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <valid_move_test_BITTEST@plt>
test   %rax,%rax
je     11b1 <main+0x71>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0x1,%ebp
jmp    11cd <main+0x8d>
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
test   %r15,%r15
setne  %bpl
lea    0xe97(%rip),%rbx
cmove  %r14,%rbx
lea    0xe65(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Beginning tests...\0A\00"
@.str.1 = [28 x i8] c"valid_move_test_SIMPLE ... \00"
@.str.2 = [6 x i8] c"PASS\0A\00"
@.str.3 = [6 x i8] c"FAIL\0A\00"
@.str.4 = [29 x i8] c"valid_move_test_BITTEST ... \00"
@.str.5 = [20 x i8] c"Tests finished: %s\0A\00"
@.str.6 = [5 x i8] c"PASS\00"
@.str.7 = [5 x i8] c"FAIL\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%5 = call i64 (...) @valid_move_test_SIMPLE()
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %2
br label %11
11: ; preds = %9, %7
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%13 = call i64 (...) @valid_move_test_BITTEST()
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %19
17: ; preds = %11
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %2
br label %19
19: ; preds = %17, %15
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %23)
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str.1 = [28 x i8] c"valid_move_test_SIMPLE ... \00"
@.str.4 = [29 x i8] c"valid_move_test_BITTEST ... \00"
@.str.5 = [20 x i8] c"Tests finished: %s\0A\00"
@str = [19 x i8] c"Beginning tests...\00"
@str.9 = [5 x i8] c"FAIL\00"
@str.11 = [5 x i8] c"PASS\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i64 (...) @valid_move_test_SIMPLE()
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.11, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.9, i64 0, i64 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i64 (...) @valid_move_test_BITTEST()
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.9, i64 0, i64 0))
br label %17
12: ; preds = %0
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.11, i64 0, i64 0))
%14 = xor i1 %4, true
%15 = zext i1 %14 to i32
%16 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.11, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.9, i64 0, i64 0)
br label %17
17: ; preds = %12, %10
%18 = phi i32 [ 1, %10 ], [ %15, %12 ]
%19 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.9, i64 0, i64 0), %10 ], [ %16, %12 ]
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %19)
ret i32 %18
}