#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*/ getchar();
int leftmost_one(int);
scalar_t__ printf(char *);
int main(void) {
  int test_hex_0;
  int assert_ret;
  test_hex_0 = 0XFF00;
  assert_ret = 0x8000;
  !(assert_ret ^ leftmost_one(test_hex_0)) &&
      printf("First example test pass!\n");
  test_hex_0 = 0x6600;
  assert_ret = 0x4000;
  !(assert_ret ^ leftmost_one(test_hex_0)) &&
      printf("Second example test pass!\n");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xff00,-0x8(%rbp)
movl   $0x8000,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <leftmost_one@plt>
mov    -0x14(%rbp),%ecx
xor    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
jne    1184 <main+0x54>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
movl   $0x6600,-0x8(%rbp)
movl   $0x4000,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <leftmost_one@plt>
mov    -0x1c(%rbp),%ecx
xor    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
jne    11cc <main+0x9c>
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xff00,%edi
call   1050 <leftmost_one@plt>
cmp    $0x8000,%eax
jne    114e <main+0x1e>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x6600,%edi
call   1050 <leftmost_one@plt>
cmp    $0x4000,%eax
jne    116b <main+0x3b>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"First example test pass!\0A\00"
@.str.1 = [27 x i8] c"Second example test pass!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 65280, i32* %2
store i32 32768, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* %2
%6 = call i32 @leftmost_one(i32 %5)
%7 = xor i32 %4, %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = call i64 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br label %12
12: ; preds = %9, %0
%13 = phi i1 [ false, %0 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
store i32 26112, i32* %2
store i32 16384, i32* %3
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = call i32 @leftmost_one(i32 %16)
%18 = xor i32 %15, %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %12
%21 = call i64 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
br label %23
23: ; preds = %20, %12
%24 = phi i1 [ false, %12 ], [ %22, %20 ]
%25 = zext i1 %24 to i32
%26 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@str = [25 x i8] c"First example test pass!\00"
@str.2 = [26 x i8] c"Second example test pass!\00"
define i32 @main() {
%1 = tail call i32 @leftmost_one(i32 65280)
%2 = icmp eq i32 %1, 32768
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @leftmost_one(i32 26112)
%7 = icmp eq i32 %6, 16384
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = tail call i32 (...) @getchar()
ret i32 0
}