#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int);
int /*<<< orphan*/ stderr;
unsigned NumberOfBitsNeeded(unsigned PowerOfTwo) {
  unsigned i;
  if (PowerOfTwo < 2) {
    fprintf(stderr,
            ">>> Error in fftmisc.c: argument %d to NumberOfBitsNeeded is too "
            "small.\n",
            PowerOfTwo);
    exit(1);
  }
  for (i = 0;; i++) {
    if (PowerOfTwo & (1 << i))
      return i;
  }
}


x86 assembly (clang, -O0):
<NumberOfBitsNeeded>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jae    1157 <NumberOfBitsNeeded+0x37>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1181 <NumberOfBitsNeeded+0x61>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    1186 <NumberOfBitsNeeded+0x66>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115e <NumberOfBitsNeeded+0x3e>

x86 assembly (clang, -O2):
<NumberOfBitsNeeded>:
mov    %edi,%edx
cmp    $0x2,%edi
jb     1139 <NumberOfBitsNeeded+0x19>
mov    $0xffffffff,%eax
nopl   0x0(%rax)
add    $0x1,%eax
bt     %eax,%edx
jae    1130 <NumberOfBitsNeeded+0x10>
ret
push   %rax
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [73 x i8] c">>> Error in fftmisc.c: argument %d to NumberOfBitsNeeded is too small.\0A\00"
define i32 @NumberOfBitsNeeded(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ult i32 %4, 2
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = load i32, i32* %2
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %1
store i32 0, i32* %3
br label %12
12: ; preds = %21, %11
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = shl i32 1, %14
%16 = and i32 %13, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = load i32, i32* %3
ret i32 %19
20: ; preds = %12
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add i32 %22, 1
store i32 %23, i32* %3
br label %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [73 x i8] c">>> Error in fftmisc.c: argument %d to NumberOfBitsNeeded is too small.\0A\00"
define i32 @NumberOfBitsNeeded(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1, %7
%8 = phi i32 [ %12, %7 ], [ 0, %1 ]
%9 = shl nuw i32 1, %8
%10 = and i32 %9, %0
%11 = icmp eq i32 %10, 0
%12 = add i32 %8, 1
br i1 %11, label %7, label %13
13: ; preds = %7
ret i32 %8
}