#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 */
scalar_t__ fftwf_malloc_plain(int);
int /*<<< orphan*/ memcpy(int *, int const *, int);
const int *fftwf_rdft2_pad(int rnk, const int *n, const int *nembed,
                           int inplace, int cmplx, int **nfree) {
  ;
  *nfree = 0;
  if (!nembed && rnk > 0) {
    if (inplace || cmplx) {
      int *np = (int *)fftwf_malloc_plain(sizeof(int) * rnk);
      memcpy(np, n, sizeof(int) * rnk);
      np[rnk - 1] = (n[rnk - 1] / 2 + 1) * (1 + !cmplx);
      nembed = *nfree = np;
    } else
      nembed = n;
  }
  return nembed;
}


x86 assembly (clang, -O0):
<fftwf_rdft2_pad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movq   $0x0,(%rax)
cmpq   $0x0,-0x18(%rbp)
jne    11fe <fftwf_rdft2_pad+0xde>
cmpl   $0x0,-0x4(%rbp)
jle    11fe <fftwf_rdft2_pad+0xde>
cmpl   $0x0,-0x1c(%rbp)
jne    1172 <fftwf_rdft2_pad+0x52>
cmpl   $0x0,-0x20(%rbp)
je     11f1 <fftwf_rdft2_pad+0xd1>
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <fftwf_malloc_plain@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
add    $0x1,%edx
cmpl   $0x0,-0x20(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x1,%eax
imul   %eax,%edx
mov    -0x30(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %rax,(%rcx)
mov    %rax,-0x18(%rbp)
jmp    11f9 <fftwf_rdft2_pad+0xd9>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    11fe <fftwf_rdft2_pad+0xde>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fftwf_rdft2_pad>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
movq   $0x0,(%r9)
test   %edi,%edi
jle    11a0 <fftwf_rdft2_pad+0x80>
test   %rbx,%rbx
jne    11a0 <fftwf_rdft2_pad+0x80>
mov    %r8d,%r12d
mov    %rsi,%rbp
or     %r8d,%ecx
je     119d <fftwf_rdft2_pad+0x7d>
mov    %r9,%r14
mov    %edi,%r15d
lea    0x0(,%r15,4),%r13d
mov    %r13d,%edi
call   1040 <fftwf_malloc_plain@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r13d,%edx
call   1030 <memcpy@plt>
add    $0xffffffff,%r15d
mov    0x0(%rbp,%r15,4),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
add    $0x1,%ecx
cmp    $0x1,%r12d
mov    $0x1,%eax
adc    $0x0,%eax
imul   %ecx,%eax
mov    %eax,(%rbx,%r15,4)
mov    %rbx,(%r14)
jmp    11a0 <fftwf_rdft2_pad+0x80>
mov    %rbp,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32* @fftwf_rdft2_pad(i32 %0, i32* %1, i32* %2, i32 %3, i32 %4, i32** %5) {
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32**
%13 = alloca i32*
store i32 %0, i32* %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32** %5, i32*** %12
%14 = load i32**, i32*** %12
store i32* null, i32** %14
%15 = load i32*, i32** %9
%16 = icmp ne i32* %15, null
br i1 %16, label %64, label %17
17: ; preds = %6
%18 = load i32, i32* %7
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %64
20: ; preds = %17
%21 = load i32, i32* %10
%22 = icmp ne i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i32, i32* %11
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %61
26: ; preds = %23, %20
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = mul i64 4, %28
%30 = trunc i64 %29 to i32
%31 = call i64 @fftwf_malloc_plain(i32 %30)
%32 = inttoptr i64 %31 to i32*
store i32* %32, i32** %13
%33 = load i32*, i32** %13
%34 = load i32*, i32** %8
%35 = load i32, i32* %7
%36 = sext i32 %35 to i64
%37 = mul i64 4, %36
%38 = trunc i64 %37 to i32
%39 = call i32 @memcpy(i32* %33, i32* %34, i32 %38)
%40 = load i32*, i32** %8
%41 = load i32, i32* %7
%42 = sub nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %40, i64 %43
%45 = load i32, i32* %44
%46 = sdiv i32 %45, 2
%47 = add nsw i32 %46, 1
%48 = load i32, i32* %11
%49 = icmp ne i32 %48, 0
%50 = xor i1 %49, true
%51 = zext i1 %50 to i32
%52 = add nsw i32 1, %51
%53 = mul nsw i32 %47, %52
%54 = load i32*, i32** %13
%55 = load i32, i32* %7
%56 = sub nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i32, i32* %54, i64 %57
store i32 %53, i32* %58
%59 = load i32*, i32** %13
%60 = load i32**, i32*** %12
store i32* %59, i32** %60
store i32* %59, i32** %9
br label %63
61: ; preds = %23
%62 = load i32*, i32** %8
store i32* %62, i32** %9
br label %63
63: ; preds = %61, %26
br label %64
64: ; preds = %63, %17, %6
%65 = load i32*, i32** %9
ret i32* %65
}

LLVM IR (-O2):
define i32* @fftwf_rdft2_pad(i32 %0, i32* %1, i32* readnone %2, i32 %3, i32 %4, i32** nocapture writeonly %5) {
store i32* null, i32** %5
%7 = icmp eq i32* %2, null
%8 = icmp sgt i32 %0, 0
%9 = and i1 %8, %7
br i1 %9, label %10, label %28
10: ; preds = %6
%11 = or i32 %4, %3
%12 = icmp eq i32 %11, 0
br i1 %12, label %28, label %13
13: ; preds = %10
%14 = icmp eq i32 %4, 0
%15 = shl i32 %0, 2
%16 = tail call i64 @fftwf_malloc_plain(i32 %15)
%17 = inttoptr i64 %16 to i32*
%18 = tail call i32 @memcpy(i32* %17, i32* %1, i32 %15)
%19 = add nsw i32 %0, -1
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %1, i64 %20
%22 = load i32, i32* %21
%23 = sdiv i32 %22, 2
%24 = add nsw i32 %23, 1
%25 = select i1 %14, i32 2, i32 1
%26 = mul nsw i32 %24, %25
%27 = getelementptr inbounds i32, i32* %17, i64 %20
store i32 %26, i32* %27
store i32* %17, i32** %5
br label %28
28: ; preds = %10, %13, %6
%29 = phi i32* [ %17, %13 ], [ %2, %6 ], [ %1, %10 ]
ret i32* %29
}