#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*/ printf(char *, unsigned int);
unsigned NumberOfBitsNeeded(unsigned PowerOfTwo) {
  unsigned i;
  if (PowerOfTwo < 2) {
    printf(">>> 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    114e <NumberOfBitsNeeded+0x2e>
mov    -0x4(%rbp),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@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     1178 <NumberOfBitsNeeded+0x58>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    117d <NumberOfBitsNeeded+0x5d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1155 <NumberOfBitsNeeded+0x35>

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

LLVM IR (-O0):
@.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 %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %1
store i32 0, i32* %3
br label %11
11: ; preds = %20, %10
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = shl i32 1, %13
%15 = and i32 %12, %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = load i32, i32* %3
ret i32 %18
19: ; preds = %11
br label %20
20: ; preds = %19
%21 = load i32, i32* %3
%22 = add i32 %21, 1
store i32 %22, i32* %3
br label %11
}

LLVM IR (-O2):
@.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 %6
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %1, %6
%7 = phi i32 [ %11, %6 ], [ 0, %1 ]
%8 = shl nuw i32 1, %7
%9 = and i32 %8, %0
%10 = icmp eq i32 %9, 0
%11 = add i32 %7, 1
br i1 %10, label %6, label %12
12: ; preds = %6
ret i32 %7
}