#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 INT64_MAX;
int INT64_MIN;
int /*<<< orphan*/ test_significant_bits(int, int);
int main(void) {
  test_significant_bits(0, 1);
  test_significant_bits(-1, 1);
  test_significant_bits(-2, 2);
  test_significant_bits(-3, 3);
  test_significant_bits(-4, 3);
  test_significant_bits(-5, 4);
  test_significant_bits(-6, 4);
  test_significant_bits(1, 2);
  test_significant_bits(2, 3);
  test_significant_bits(3, 3);
  test_significant_bits(4, 4);
  test_significant_bits(5, 4);
  test_significant_bits(6, 4);
  test_significant_bits(INT64_MIN, 64);
  test_significant_bits(INT64_MAX, 64);
  test_significant_bits(INT64_MIN / 2, 63);
  test_significant_bits(-(INT64_MIN / 2), 64);
  test_significant_bits(0x55555555, 32);
  test_significant_bits(-0x55555555, 32);
  test_significant_bits(0x800000, 25);
  test_significant_bits(0x80000, 21);
  test_significant_bits(0x8000, 17);
  test_significant_bits(0x800, 13);
  test_significant_bits(0x80, 9);
  test_significant_bits(0x8, 5);
  test_significant_bits(-0x800000, 24);
  test_significant_bits(-0x80000, 20);
  test_significant_bits(-0x8000, 16);
  test_significant_bits(-0x800, 12);
  test_significant_bits(-0x80, 8);
  test_significant_bits(-0x8, 4);
  test_significant_bits(0x7FFFFF, 24);
  test_significant_bits(0x7FFFF, 20);
  test_significant_bits(0x7FFF, 16);
  test_significant_bits(0x7FF, 12);
  test_significant_bits(0x7F, 8);
  test_significant_bits(0x7, 4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <test_significant_bits@plt>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffffe,%edi
mov    $0x2,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffffd,%edi
mov    $0x3,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffffc,%edi
mov    $0x3,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffffb,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffffa,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <test_significant_bits@plt>
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <test_significant_bits@plt>
mov    $0x3,%esi
mov    %esi,%edi
call   1030 <test_significant_bits@plt>
mov    $0x4,%esi
mov    %esi,%edi
call   1030 <test_significant_bits@plt>
mov    $0x5,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    $0x6,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%edi
mov    $0x40,%esi
call   1030 <test_significant_bits@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
mov    $0x40,%esi
call   1030 <test_significant_bits@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    $0x3f,%esi
call   1030 <test_significant_bits@plt>
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
xor    %edi,%edi
sub    %eax,%edi
mov    $0x40,%esi
call   1030 <test_significant_bits@plt>
mov    $0x55555555,%edi
mov    $0x20,%esi
call   1030 <test_significant_bits@plt>
mov    $0xaaaaaaab,%edi
mov    $0x20,%esi
call   1030 <test_significant_bits@plt>
mov    $0x800000,%edi
mov    $0x19,%esi
call   1030 <test_significant_bits@plt>
mov    $0x80000,%edi
mov    $0x15,%esi
call   1030 <test_significant_bits@plt>
mov    $0x8000,%edi
mov    $0x11,%esi
call   1030 <test_significant_bits@plt>
mov    $0x800,%edi
mov    $0xd,%esi
call   1030 <test_significant_bits@plt>
mov    $0x80,%edi
mov    $0x9,%esi
call   1030 <test_significant_bits@plt>
mov    $0x8,%edi
mov    $0x5,%esi
call   1030 <test_significant_bits@plt>
mov    $0xff800000,%edi
mov    $0x18,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfff80000,%edi
mov    $0x14,%esi
call   1030 <test_significant_bits@plt>
mov    $0xffff8000,%edi
mov    $0x10,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffff800,%edi
mov    $0xc,%esi
call   1030 <test_significant_bits@plt>
mov    $0xffffff80,%edi
mov    $0x8,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffff8,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7fffff,%edi
mov    $0x18,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7ffff,%edi
mov    $0x14,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7fff,%edi
mov    $0x10,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7ff,%edi
mov    $0xc,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7f,%edi
mov    $0x8,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <test_significant_bits@plt>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffffe,%edi
mov    $0x2,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffffd,%edi
mov    $0x3,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffffc,%edi
mov    $0x3,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffffb,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffffa,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <test_significant_bits@plt>
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <test_significant_bits@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1030 <test_significant_bits@plt>
mov    $0x4,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    $0x5,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    $0x6,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    0x2e08(%rip),%rbx
mov    (%rbx),%edi
mov    $0x40,%esi
call   1030 <test_significant_bits@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
mov    $0x40,%esi
call   1030 <test_significant_bits@plt>
mov    (%rbx),%eax
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
mov    $0x3f,%esi
call   1030 <test_significant_bits@plt>
mov    (%rbx),%eax
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
neg    %edi
mov    $0x40,%esi
call   1030 <test_significant_bits@plt>
mov    $0x55555555,%edi
mov    $0x20,%esi
call   1030 <test_significant_bits@plt>
mov    $0xaaaaaaab,%edi
mov    $0x20,%esi
call   1030 <test_significant_bits@plt>
mov    $0x800000,%edi
mov    $0x19,%esi
call   1030 <test_significant_bits@plt>
mov    $0x80000,%edi
mov    $0x15,%esi
call   1030 <test_significant_bits@plt>
mov    $0x8000,%edi
mov    $0x11,%esi
call   1030 <test_significant_bits@plt>
mov    $0x800,%edi
mov    $0xd,%esi
call   1030 <test_significant_bits@plt>
mov    $0x80,%edi
mov    $0x9,%esi
call   1030 <test_significant_bits@plt>
mov    $0x8,%edi
mov    $0x5,%esi
call   1030 <test_significant_bits@plt>
mov    $0xff800000,%edi
mov    $0x18,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfff80000,%edi
mov    $0x14,%esi
call   1030 <test_significant_bits@plt>
mov    $0xffff8000,%edi
mov    $0x10,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffff800,%edi
mov    $0xc,%esi
call   1030 <test_significant_bits@plt>
mov    $0xffffff80,%edi
mov    $0x8,%esi
call   1030 <test_significant_bits@plt>
mov    $0xfffffff8,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7fffff,%edi
mov    $0x18,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7ffff,%edi
mov    $0x14,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7fff,%edi
mov    $0x10,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7ff,%edi
mov    $0xc,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7f,%edi
mov    $0x8,%esi
call   1030 <test_significant_bits@plt>
mov    $0x7,%edi
mov    $0x4,%esi
call   1030 <test_significant_bits@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@INT64_MIN = global i32 0
@INT64_MAX = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test_significant_bits(i32 0, i32 1)
%3 = call i32 @test_significant_bits(i32 -1, i32 1)
%4 = call i32 @test_significant_bits(i32 -2, i32 2)
%5 = call i32 @test_significant_bits(i32 -3, i32 3)
%6 = call i32 @test_significant_bits(i32 -4, i32 3)
%7 = call i32 @test_significant_bits(i32 -5, i32 4)
%8 = call i32 @test_significant_bits(i32 -6, i32 4)
%9 = call i32 @test_significant_bits(i32 1, i32 2)
%10 = call i32 @test_significant_bits(i32 2, i32 3)
%11 = call i32 @test_significant_bits(i32 3, i32 3)
%12 = call i32 @test_significant_bits(i32 4, i32 4)
%13 = call i32 @test_significant_bits(i32 5, i32 4)
%14 = call i32 @test_significant_bits(i32 6, i32 4)
%15 = load i32, i32* @INT64_MIN
%16 = call i32 @test_significant_bits(i32 %15, i32 64)
%17 = load i32, i32* @INT64_MAX
%18 = call i32 @test_significant_bits(i32 %17, i32 64)
%19 = load i32, i32* @INT64_MIN
%20 = sdiv i32 %19, 2
%21 = call i32 @test_significant_bits(i32 %20, i32 63)
%22 = load i32, i32* @INT64_MIN
%23 = sdiv i32 %22, 2
%24 = sub nsw i32 0, %23
%25 = call i32 @test_significant_bits(i32 %24, i32 64)
%26 = call i32 @test_significant_bits(i32 1431655765, i32 32)
%27 = call i32 @test_significant_bits(i32 -1431655765, i32 32)
%28 = call i32 @test_significant_bits(i32 8388608, i32 25)
%29 = call i32 @test_significant_bits(i32 524288, i32 21)
%30 = call i32 @test_significant_bits(i32 32768, i32 17)
%31 = call i32 @test_significant_bits(i32 2048, i32 13)
%32 = call i32 @test_significant_bits(i32 128, i32 9)
%33 = call i32 @test_significant_bits(i32 8, i32 5)
%34 = call i32 @test_significant_bits(i32 -8388608, i32 24)
%35 = call i32 @test_significant_bits(i32 -524288, i32 20)
%36 = call i32 @test_significant_bits(i32 -32768, i32 16)
%37 = call i32 @test_significant_bits(i32 -2048, i32 12)
%38 = call i32 @test_significant_bits(i32 -128, i32 8)
%39 = call i32 @test_significant_bits(i32 -8, i32 4)
%40 = call i32 @test_significant_bits(i32 8388607, i32 24)
%41 = call i32 @test_significant_bits(i32 524287, i32 20)
%42 = call i32 @test_significant_bits(i32 32767, i32 16)
%43 = call i32 @test_significant_bits(i32 2047, i32 12)
%44 = call i32 @test_significant_bits(i32 127, i32 8)
%45 = call i32 @test_significant_bits(i32 7, i32 4)
ret i32 0
}

LLVM IR (-O2):
@INT64_MIN = global i32 0
@INT64_MAX = global i32 0
define i32 @main() {
%1 = tail call i32 @test_significant_bits(i32 0, i32 1)
%2 = tail call i32 @test_significant_bits(i32 -1, i32 1)
%3 = tail call i32 @test_significant_bits(i32 -2, i32 2)
%4 = tail call i32 @test_significant_bits(i32 -3, i32 3)
%5 = tail call i32 @test_significant_bits(i32 -4, i32 3)
%6 = tail call i32 @test_significant_bits(i32 -5, i32 4)
%7 = tail call i32 @test_significant_bits(i32 -6, i32 4)
%8 = tail call i32 @test_significant_bits(i32 1, i32 2)
%9 = tail call i32 @test_significant_bits(i32 2, i32 3)
%10 = tail call i32 @test_significant_bits(i32 3, i32 3)
%11 = tail call i32 @test_significant_bits(i32 4, i32 4)
%12 = tail call i32 @test_significant_bits(i32 5, i32 4)
%13 = tail call i32 @test_significant_bits(i32 6, i32 4)
%14 = load i32, i32* @INT64_MIN
%15 = tail call i32 @test_significant_bits(i32 %14, i32 64)
%16 = load i32, i32* @INT64_MAX
%17 = tail call i32 @test_significant_bits(i32 %16, i32 64)
%18 = load i32, i32* @INT64_MIN
%19 = sdiv i32 %18, 2
%20 = tail call i32 @test_significant_bits(i32 %19, i32 63)
%21 = load i32, i32* @INT64_MIN
%22 = sdiv i32 %21, -2
%23 = tail call i32 @test_significant_bits(i32 %22, i32 64)
%24 = tail call i32 @test_significant_bits(i32 1431655765, i32 32)
%25 = tail call i32 @test_significant_bits(i32 -1431655765, i32 32)
%26 = tail call i32 @test_significant_bits(i32 8388608, i32 25)
%27 = tail call i32 @test_significant_bits(i32 524288, i32 21)
%28 = tail call i32 @test_significant_bits(i32 32768, i32 17)
%29 = tail call i32 @test_significant_bits(i32 2048, i32 13)
%30 = tail call i32 @test_significant_bits(i32 128, i32 9)
%31 = tail call i32 @test_significant_bits(i32 8, i32 5)
%32 = tail call i32 @test_significant_bits(i32 -8388608, i32 24)
%33 = tail call i32 @test_significant_bits(i32 -524288, i32 20)
%34 = tail call i32 @test_significant_bits(i32 -32768, i32 16)
%35 = tail call i32 @test_significant_bits(i32 -2048, i32 12)
%36 = tail call i32 @test_significant_bits(i32 -128, i32 8)
%37 = tail call i32 @test_significant_bits(i32 -8, i32 4)
%38 = tail call i32 @test_significant_bits(i32 8388607, i32 24)
%39 = tail call i32 @test_significant_bits(i32 524287, i32 20)
%40 = tail call i32 @test_significant_bits(i32 32767, i32 16)
%41 = tail call i32 @test_significant_bits(i32 2047, i32 12)
%42 = tail call i32 @test_significant_bits(i32 127, i32 8)
%43 = tail call i32 @test_significant_bits(i32 7, i32 4)
ret i32 0
}