#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*/ abort();
int leading_one(int);
int leading_one_l(int);
int main() {
  if (leading_one(0b00100101) != 5) {
    abort();
  }
  if (leading_one(1) != 0) {
    abort();
  }
  if (leading_one(-1) != 31) {
    abort();
  }
  if (leading_one_l(0b00100101) != 5) {
    abort();
  }
  if (leading_one_l(1) != 0) {
    abort();
  }
  if (leading_one_l(-1) != 63) {
    abort();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x25,%edi
call   1050 <leading_one@plt>
cmp    $0x5,%eax
je     114e <main+0x1e>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x1,%edi
call   1050 <leading_one@plt>
cmp    $0x0,%eax
je     1168 <main+0x38>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0xffffffff,%edi
call   1050 <leading_one@plt>
cmp    $0x1f,%eax
je     1182 <main+0x52>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x25,%edi
call   1040 <leading_one_l@plt>
cmp    $0x5,%eax
je     119c <main+0x6c>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x1,%edi
call   1040 <leading_one_l@plt>
cmp    $0x0,%eax
je     11b6 <main+0x86>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0xffffffff,%edi
call   1040 <leading_one_l@plt>
cmp    $0x3f,%eax
je     11d0 <main+0xa0>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x25,%edi
call   1050 <leading_one@plt>
cmp    $0x5,%eax
jne    118d <main+0x5d>
mov    $0x1,%edi
call   1050 <leading_one@plt>
test   %eax,%eax
jne    118d <main+0x5d>
mov    $0xffffffff,%edi
call   1050 <leading_one@plt>
cmp    $0x1f,%eax
jne    118d <main+0x5d>
mov    $0x25,%edi
call   1040 <leading_one_l@plt>
cmp    $0x5,%eax
jne    118d <main+0x5d>
mov    $0x1,%edi
call   1040 <leading_one_l@plt>
test   %eax,%eax
jne    118d <main+0x5d>
mov    $0xffffffff,%edi
call   1040 <leading_one_l@plt>
cmp    $0x3f,%eax
jne    118d <main+0x5d>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @leading_one(i32 37)
%2 = icmp ne i32 %1, 5
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = call i32 @leading_one(i32 1)
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = call i32 @leading_one(i32 -1)
%12 = icmp ne i32 %11, 31
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %10
%16 = call i32 @leading_one_l(i32 37)
%17 = icmp ne i32 %16, 5
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 (...) @abort()
unreachable
20: ; preds = %15
%21 = call i32 @leading_one_l(i32 1)
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (...) @abort()
unreachable
25: ; preds = %20
%26 = call i32 @leading_one_l(i32 -1)
%27 = icmp ne i32 %26, 63
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @abort()
unreachable
30: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @leading_one(i32 37)
%2 = icmp eq i32 %1, 5
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @leading_one(i32 1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @leading_one(i32 -1)
%12 = icmp eq i32 %11, 31
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
%16 = tail call i32 @leading_one_l(i32 37)
%17 = icmp eq i32 %16, 5
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 (...) @abort()
unreachable
20: ; preds = %15
%21 = tail call i32 @leading_one_l(i32 1)
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = tail call i32 (...) @abort()
unreachable
25: ; preds = %20
%26 = tail call i32 @leading_one_l(i32 -1)
%27 = icmp eq i32 %26, 63
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i32 (...) @abort()
unreachable
30: ; preds = %25
ret i32 0
}