#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 iAlignUp(int, int);
int computeFFTsize(int dataSize) {
  int hiBit;
  unsigned int lowPOT, hiPOT;
  dataSize = iAlignUp(dataSize, 16);
  for (hiBit = 31; hiBit >= 0; hiBit--)
    if (dataSize & (1U << hiBit))
      break;
  lowPOT = 1U << hiBit;
  if (lowPOT == dataSize)
    return dataSize;
  hiPOT = 1U << (hiBit + 1);
  return hiPOT;
}


x86 assembly (clang, -O0):
<computeFFTsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x10,%esi
call   1030 <iAlignUp@plt>
mov    %eax,-0x8(%rbp)
movl   $0x1f,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     116e <computeFFTsize+0x5e>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     115b <computeFFTsize+0x4b>
jmp    116e <computeFFTsize+0x5e>
jmp    1160 <computeFFTsize+0x50>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1132 <computeFFTsize+0x22>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1192 <computeFFTsize+0x82>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a8 <computeFFTsize+0x98>
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeFFTsize>:
push   %rax
mov    $0x10,%esi
call   1030 <iAlignUp@plt>
mov    $0x1c,%ecx
lea    0x3(%rcx),%edx
movzbl %dl,%edx
bt     %edx,%eax
jb     1155 <computeFFTsize+0x45>
lea    0x2(%rcx),%edx
movzbl %dl,%edx
bt     %edx,%eax
jb     115a <computeFFTsize+0x4a>
lea    0x1(%rcx),%edx
movzbl %dl,%edx
bt     %edx,%eax
jb     115f <computeFFTsize+0x4f>
bt     %ecx,%eax
jb     1162 <computeFFTsize+0x52>
add    $0xfffffffc,%ecx
cmp    $0xfffffffc,%ecx
jne    1120 <computeFFTsize+0x10>
mov    $0xffffffff,%ecx
jmp    1162 <computeFFTsize+0x52>
add    $0x3,%ecx
jmp    1162 <computeFFTsize+0x52>
add    $0x2,%ecx
jmp    1162 <computeFFTsize+0x52>
add    $0x1,%ecx
mov    $0x1,%edx
mov    $0x1,%esi
shl    %cl,%esi
add    $0x1,%cl
shl    %cl,%edx
cmp    %eax,%esi
cmove  %eax,%edx
mov    %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @computeFFTsize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @iAlignUp(i32 %7, i32 16)
store i32 %8, i32* %3
store i32 31, i32* %4
br label %9
9: ; preds = %20, %1
%10 = load i32, i32* %4
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %23
12: ; preds = %9
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = shl i32 1, %14
%16 = and i32 %13, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %12
br label %23
19: ; preds = %12
br label %20
20: ; preds = %19
%21 = load i32, i32* %4
%22 = add nsw i32 %21, -1
store i32 %22, i32* %4
br label %9
23: ; preds = %18, %9
%24 = load i32, i32* %4
%25 = shl i32 1, %24
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = load i32, i32* %3
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = load i32, i32* %3
store i32 %30, i32* %2
br label %36
31: ; preds = %23
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
%34 = shl i32 1, %33
store i32 %34, i32* %6
%35 = load i32, i32* %6
store i32 %35, i32* %2
br label %36
36: ; preds = %31, %29
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
define i32 @computeFFTsize(i32 %0) {
%2 = tail call i32 @iAlignUp(i32 %0, i32 16)
br label %3
3: ; preds = %23, %1
%4 = phi i32 [ 31, %1 ], [ %24, %23 ]
%5 = shl nuw i32 1, %4
%6 = and i32 %5, %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %26
8: ; preds = %3
%9 = add nsw i32 %4, -1
%10 = shl nuw i32 1, %9
%11 = and i32 %10, %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %26
13: ; preds = %8
%14 = add nsw i32 %4, -2
%15 = shl nuw i32 1, %14
%16 = and i32 %15, %2
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %13
%19 = add nsw i32 %4, -3
%20 = shl nuw i32 1, %19
%21 = and i32 %20, %2
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = add nsw i32 %4, -4
%25 = icmp eq i32 %19, 0
br i1 %25, label %26, label %3
26: ; preds = %23, %18, %13, %8, %3
%27 = phi i32 [ %4, %3 ], [ %9, %8 ], [ %14, %13 ], [ %19, %18 ], [ -1, %23 ]
%28 = shl nuw i32 1, %27
%29 = icmp eq i32 %28, %2
%30 = add nsw i32 %27, 1
%31 = shl nuw i32 1, %30
%32 = select i1 %29, i32 %2, i32 %31
ret i32 %32
}