#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 kissf_fft_next_fast_size(int n) {
  while (1) {
    int m = n;
    while ((m % 2) == 0)
      m /= 2;
    while ((m % 3) == 0)
      m /= 3;
    while ((m % 5) == 0)
      m /= 5;
    if (m <= 1)
      break;
    n++;
  }
  return n;
}


x86 assembly (clang, -O0):
<kissf_fft_next_fast_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1134 <kissf_fft_next_fast_size+0x34>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    110d <kissf_fft_next_fast_size+0xd>
jmp    1139 <kissf_fft_next_fast_size+0x39>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1160 <kissf_fft_next_fast_size+0x60>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1139 <kissf_fft_next_fast_size+0x39>
jmp    1165 <kissf_fft_next_fast_size+0x65>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    118c <kissf_fft_next_fast_size+0x8c>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1165 <kissf_fft_next_fast_size+0x65>
cmpl   $0x1,-0x8(%rbp)
jg     119b <kissf_fft_next_fast_size+0x9b>
jmp    11a9 <kissf_fft_next_fast_size+0xa9>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1107 <kissf_fft_next_fast_size+0x7>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kissf_fft_next_fast_size>:
jmp    111c <kissf_fft_next_fast_size+0x1c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rax),%edi
cmp    $0x1,%ecx
jle    11e0 <kissf_fft_next_fast_size+0xe0>
mov    %edi,%eax
mov    %edi,%ecx
test   $0x1,%al
jne    1140 <kissf_fft_next_fast_size+0x40>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
mov    %edx,%ecx
test   $0x1,%dl
je     1130 <kissf_fft_next_fast_size+0x30>
imul   $0xaaaaaaab,%ecx,%edx
add    $0x2aaaaaaa,%edx
cmp    $0x55555554,%edx
ja     118b <kissf_fft_next_fast_size+0x8b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %ecx,%rcx
imul   $0x55555556,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
imul   $0xaaaaaaab,%ecx,%edx
add    $0x2aaaaaaa,%edx
cmp    $0x55555555,%edx
jb     1160 <kissf_fft_next_fast_size+0x60>
imul   $0xcccccccd,%ecx,%edx
add    $0x19999999,%edx
cmp    $0x33333332,%edx
ja     1110 <kissf_fft_next_fast_size+0x10>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %ecx,%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
imul   $0xcccccccd,%ecx,%edx
add    $0x19999999,%edx
cmp    $0x33333333,%edx
jb     11b0 <kissf_fft_next_fast_size+0xb0>
jmp    1110 <kissf_fft_next_fast_size+0x10>
ret

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

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