#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*/ factorize(int, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
void transTableSetup(int sofar[], int actual[], int remain[], int *nFact,
                     int *nPoints) {
  int i;
  factorize(*nPoints, nFact, actual);
  if (actual[1] > 37) {
    printf("\nPrime factor of FFT length too large : %6d", actual[1]);
    printf("\nPlease modify the value of maxPrimeFactor in mixfft.c");
    exit(1);
  }
  remain[0] = *nPoints;
  sofar[1] = 1;
  remain[1] = *nPoints / actual[1];
  for (i = 2; i <= *nFact; i++) {
    sofar[i] = sofar[i - 1] * actual[i - 1];
    remain[i] = remain[i - 1] / actual[i];
  }
}


x86 assembly (clang, -O0):
<transTableSetup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <factorize@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x25,0x4(%rax)
jle    119a <transTableSetup+0x6a>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0x4(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cltd
idivl  0x4(%rcx)
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
movl   $0x2,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jg     1241 <transTableSetup+0x111>
mov    -0x8(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
movslq -0x2c(%rbp),%rsi
cltd
idivl  (%rcx,%rsi,4)
mov    %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11cf <transTableSetup+0x9f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transTableSetup>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,%r13
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
mov    (%r8),%edi
mov    %rcx,%rsi
mov    %rbx,%rdx
call   1050 <factorize@plt>
mov    0x4(%rbx),%esi
cmp    $0x26,%esi
jge    11c1 <transTableSetup+0x91>
mov    0x0(%r13),%eax
mov    %eax,(%r15)
movl   $0x1,0x4(%r12)
mov    0x0(%r13),%eax
cltd
idivl  0x4(%rbx)
mov    %eax,0x4(%r15)
cmpl   $0x2,(%r14)
jl     11b7 <transTableSetup+0x87>
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx,%rcx,4),%eax
imul   (%r12,%rcx,4),%eax
mov    %eax,0x4(%r12,%rcx,4)
mov    (%r15,%rcx,4),%eax
cltd
idivl  0x4(%rbx,%rcx,4)
mov    %eax,0x4(%r15,%rcx,4)
movslq (%r14),%rax
add    $0x1,%rcx
cmp    %rax,%rcx
jl     1190 <transTableSetup+0x60>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe38(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe56(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"\0APrime factor of FFT length too large : %6d\00"
@.str.1 = [55 x i8] c"\0APlease modify the value of maxPrimeFactor in mixfft.c\00"
define void @transTableSetup(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%12 = load i32*, i32** %10
%13 = load i32, i32* %12
%14 = load i32*, i32** %9
%15 = load i32*, i32** %7
%16 = call i32 @factorize(i32 %13, i32* %14, i32* %15)
%17 = load i32*, i32** %7
%18 = getelementptr inbounds i32, i32* %17, i64 1
%19 = load i32, i32* %18
%20 = icmp sgt i32 %19, 37
br i1 %20, label %21, label %28
21: ; preds = %5
%22 = load i32*, i32** %7
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %5
%29 = load i32*, i32** %10
%30 = load i32, i32* %29
%31 = load i32*, i32** %8
%32 = getelementptr inbounds i32, i32* %31, i64 0
store i32 %30, i32* %32
%33 = load i32*, i32** %6
%34 = getelementptr inbounds i32, i32* %33, i64 1
store i32 1, i32* %34
%35 = load i32*, i32** %10
%36 = load i32, i32* %35
%37 = load i32*, i32** %7
%38 = getelementptr inbounds i32, i32* %37, i64 1
%39 = load i32, i32* %38
%40 = sdiv i32 %36, %39
%41 = load i32*, i32** %8
%42 = getelementptr inbounds i32, i32* %41, i64 1
store i32 %40, i32* %42
store i32 2, i32* %11
br label %43
43: ; preds = %82, %28
%44 = load i32, i32* %11
%45 = load i32*, i32** %9
%46 = load i32, i32* %45
%47 = icmp sle i32 %44, %46
br i1 %47, label %48, label %85
48: ; preds = %43
%49 = load i32*, i32** %6
%50 = load i32, i32* %11
%51 = sub nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %49, i64 %52
%54 = load i32, i32* %53
%55 = load i32*, i32** %7
%56 = load i32, i32* %11
%57 = sub nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %55, i64 %58
%60 = load i32, i32* %59
%61 = mul nsw i32 %54, %60
%62 = load i32*, i32** %6
%63 = load i32, i32* %11
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i32, i32* %62, i64 %64
store i32 %61, i32* %65
%66 = load i32*, i32** %8
%67 = load i32, i32* %11
%68 = sub nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %66, i64 %69
%71 = load i32, i32* %70
%72 = load i32*, i32** %7
%73 = load i32, i32* %11
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i32, i32* %72, i64 %74
%76 = load i32, i32* %75
%77 = sdiv i32 %71, %76
%78 = load i32*, i32** %8
%79 = load i32, i32* %11
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i32, i32* %78, i64 %80
store i32 %77, i32* %81
br label %82
82: ; preds = %48
%83 = load i32, i32* %11
%84 = add nsw i32 %83, 1
store i32 %84, i32* %11
br label %43
85: ; preds = %43
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"\0APrime factor of FFT length too large : %6d\00"
@.str.1 = [55 x i8] c"\0APlease modify the value of maxPrimeFactor in mixfft.c\00"
define void @transTableSetup(i32* nocapture %0, i32* %1, i32* nocapture %2, i32* %3, i32* nocapture %4) {
%6 = load i32, i32* %4
%7 = tail call i32 @factorize(i32 %6, i32* %3, i32* %1)
%8 = getelementptr inbounds i32, i32* %1, i64 1
%9 = load i32, i32* %8
%10 = icmp sgt i32 %9, 37
br i1 %10, label %11, label %15
11: ; preds = %5
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i32 %9)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %5
%16 = load i32, i32* %4
store i32 %16, i32* %2
%17 = getelementptr inbounds i32, i32* %0, i64 1
store i32 1, i32* %17
%18 = load i32, i32* %4
%19 = load i32, i32* %8
%20 = sdiv i32 %18, %19
%21 = getelementptr inbounds i32, i32* %2, i64 1
store i32 %20, i32* %21
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 2
br i1 %23, label %43, label %24
24: ; preds = %15, %24
%25 = phi i64 [ %39, %24 ], [ 2, %15 ]
%26 = add nsw i64 %25, -1
%27 = getelementptr inbounds i32, i32* %0, i64 %26
%28 = load i32, i32* %27
%29 = getelementptr inbounds i32, i32* %1, i64 %26
%30 = load i32, i32* %29
%31 = mul nsw i32 %30, %28
%32 = getelementptr inbounds i32, i32* %0, i64 %25
store i32 %31, i32* %32
%33 = getelementptr inbounds i32, i32* %2, i64 %26
%34 = load i32, i32* %33
%35 = getelementptr inbounds i32, i32* %1, i64 %25
%36 = load i32, i32* %35
%37 = sdiv i32 %34, %36
%38 = getelementptr inbounds i32, i32* %2, i64 %25
store i32 %37, i32* %38
%39 = add nuw nsw i64 %25, 1
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = icmp slt i64 %25, %41
br i1 %42, label %24, label %43
43: ; preds = %24, %15
ret void
}