#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*/ SCIprintf(char *, ...);
void fft_real_mon(double din_re[], const int npoint, const int interval,
                  double out_re[], double out_im[]) {
  int i;
  int fi, fi_max;
  if (npoint != 8)
    return;
  SCIprintf("----------------------------------------\n");
  SCIprintf("DEBUG MON: fft_real_mon: npoint=%d, interval=%d\n", npoint,
            interval);
  SCIprintf("---input---\n");
  for (i = 0; i < npoint; i++) {
    SCIprintf(" i=%3d: re = %12.3le\n", i, din_re[i]);
  }
  SCIprintf("---output---\n");
  fi_max = npoint / 2;
  for (fi = 0; fi <= fi_max; fi++) {
    SCIprintf(" fi=%2d: re = %12.3le, im = %12.3le\n", fi, out_re[fi],
              out_im[fi]);
  }
  SCIprintf("----------------------------------------\n");
}


x86 assembly (clang, -O0):
<fft_real_mon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
cmpl   $0x8,-0xc(%rbp)
je     1139 <fft_real_mon+0x29>
jmp    121e <fft_real_mon+0x10e>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <SCIprintf@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <SCIprintf@plt>
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <SCIprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a8 <fft_real_mon+0x98>
mov    -0x24(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xed5(%rip),%rdi
mov    $0x1,%al
call   1030 <SCIprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1170 <fft_real_mon+0x60>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <SCIprintf@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     1210 <fft_real_mon+0x100>
mov    -0x28(%rbp),%esi
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xe91(%rip),%rdi
mov    $0x2,%al
call   1030 <SCIprintf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11cb <fft_real_mon+0xbb>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <SCIprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fft_real_mon>:
cmp    $0x8,%esi
jne    12ba <fft_real_mon+0x1aa>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %rcx,%r12
mov    %edx,%ebp
mov    %rdi,%rbx
lea    0xeca(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <SCIprintf@plt>
lea    0xee3(%rip),%rdi
mov    $0x8,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <SCIprintf@plt>
lea    0xeff(%rip),%rdi
xor    %eax,%eax
call   1030 <SCIprintf@plt>
movsd  (%rbx),%xmm0
lea    0xefa(%rip),%r13
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x1,%al
call   1030 <SCIprintf@plt>
movsd  0x8(%rbx),%xmm0
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1030 <SCIprintf@plt>
movsd  0x10(%rbx),%xmm0
mov    %r13,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1030 <SCIprintf@plt>
movsd  0x18(%rbx),%xmm0
mov    %r13,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1030 <SCIprintf@plt>
movsd  0x20(%rbx),%xmm0
mov    %r13,%rdi
mov    $0x4,%esi
mov    $0x1,%al
call   1030 <SCIprintf@plt>
movsd  0x28(%rbx),%xmm0
mov    %r13,%rdi
mov    $0x5,%esi
mov    $0x1,%al
call   1030 <SCIprintf@plt>
movsd  0x30(%rbx),%xmm0
mov    %r13,%rdi
mov    $0x6,%esi
mov    $0x1,%al
call   1030 <SCIprintf@plt>
movsd  0x38(%rbx),%xmm0
mov    %r13,%rdi
mov    $0x7,%esi
mov    $0x1,%al
call   1030 <SCIprintf@plt>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1030 <SCIprintf@plt>
movsd  (%r12),%xmm0
movsd  (%r15),%xmm1
lea    0xe66(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%al
call   1030 <SCIprintf@plt>
movsd  0x8(%r12),%xmm0
movsd  0x8(%r15),%xmm1
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2,%al
call   1030 <SCIprintf@plt>
movsd  0x10(%r12),%xmm0
movsd  0x10(%r15),%xmm1
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%al
call   1030 <SCIprintf@plt>
movsd  0x18(%r12),%xmm0
movsd  0x18(%r15),%xmm1
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x2,%al
call   1030 <SCIprintf@plt>
movsd  0x20(%r12),%xmm0
movsd  0x20(%r15),%xmm1
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x2,%al
call   1030 <SCIprintf@plt>
mov    %r14,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <SCIprintf@plt>
ret

LLVM IR (-O0):
@.str = [42 x i8] c"----------------------------------------\0A\00"
@.str.1 = [49 x i8] c"DEBUG MON: fft_real_mon: npoint=%d, interval=%d\0A\00"
@.str.2 = [13 x i8] c"---input---\0A\00"
@.str.3 = [22 x i8] c" i=%3d: re = %12.3le\0A\00"
@.str.4 = [14 x i8] c"---output---\0A\00"
@.str.5 = [37 x i8] c" fi=%2d: re = %12.3le, im = %12.3le\0A\00"
define void @fft_real_mon(double* %0, i32 %1, i32 %2, double* %3, double* %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store double* %0, double** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double* %3, double** %9
store double* %4, double** %10
%14 = load i32, i32* %7
%15 = icmp ne i32 %14, 8
br i1 %15, label %16, label %17
16: ; preds = %5
br label %64
17: ; preds = %5
%18 = call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20)
%22 = call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %11
br label %23
23: ; preds = %35, %17
%24 = load i32, i32* %11
%25 = load i32, i32* %7
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %38
27: ; preds = %23
%28 = load i32, i32* %11
%29 = load double*, double** %6
%30 = load i32, i32* %11
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %28, double %33)
br label %35
35: ; preds = %27
%36 = load i32, i32* %11
%37 = add nsw i32 %36, 1
store i32 %37, i32* %11
br label %23
38: ; preds = %23
%39 = call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%40 = load i32, i32* %7
%41 = sdiv i32 %40, 2
store i32 %41, i32* %13
store i32 0, i32* %12
br label %42
42: ; preds = %59, %38
%43 = load i32, i32* %12
%44 = load i32, i32* %13
%45 = icmp sle i32 %43, %44
br i1 %45, label %46, label %62
46: ; preds = %42
%47 = load i32, i32* %12
%48 = load double*, double** %9
%49 = load i32, i32* %12
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %10
%54 = load i32, i32* %12
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %47, double %52, double %57)
br label %59
59: ; preds = %46
%60 = load i32, i32* %12
%61 = add nsw i32 %60, 1
store i32 %61, i32* %12
br label %42
62: ; preds = %42
%63 = call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %64
64: ; preds = %62, %16
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"----------------------------------------\0A\00"
@.str.1 = [49 x i8] c"DEBUG MON: fft_real_mon: npoint=%d, interval=%d\0A\00"
@.str.2 = [13 x i8] c"---input---\0A\00"
@.str.3 = [22 x i8] c" i=%3d: re = %12.3le\0A\00"
@.str.4 = [14 x i8] c"---output---\0A\00"
@.str.5 = [37 x i8] c" fi=%2d: re = %12.3le, im = %12.3le\0A\00"
define void @fft_real_mon(double* nocapture %0, i32 %1, i32 %2, double* nocapture %3, double* nocapture %4) {
%6 = icmp eq i32 %1, 8
br i1 %6, label %7, label %59
7: ; preds = %5
%8 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 %2)
%10 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%11 = load double, double* %0
%12 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 0, double %11)
%13 = getelementptr inbounds double, double* %0, i64 1
%14 = load double, double* %13
%15 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 1, double %14)
%16 = getelementptr inbounds double, double* %0, i64 2
%17 = load double, double* %16
%18 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 2, double %17)
%19 = getelementptr inbounds double, double* %0, i64 3
%20 = load double, double* %19
%21 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 3, double %20)
%22 = getelementptr inbounds double, double* %0, i64 4
%23 = load double, double* %22
%24 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 4, double %23)
%25 = getelementptr inbounds double, double* %0, i64 5
%26 = load double, double* %25
%27 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 5, double %26)
%28 = getelementptr inbounds double, double* %0, i64 6
%29 = load double, double* %28
%30 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 6, double %29)
%31 = getelementptr inbounds double, double* %0, i64 7
%32 = load double, double* %31
%33 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 7, double %32)
%34 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%35 = load double, double* %3
%36 = load double, double* %4
%37 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 0, double %35, double %36)
%38 = getelementptr inbounds double, double* %3, i64 1
%39 = load double, double* %38
%40 = getelementptr inbounds double, double* %4, i64 1
%41 = load double, double* %40
%42 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 1, double %39, double %41)
%43 = getelementptr inbounds double, double* %3, i64 2
%44 = load double, double* %43
%45 = getelementptr inbounds double, double* %4, i64 2
%46 = load double, double* %45
%47 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 2, double %44, double %46)
%48 = getelementptr inbounds double, double* %3, i64 3
%49 = load double, double* %48
%50 = getelementptr inbounds double, double* %4, i64 3
%51 = load double, double* %50
%52 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 3, double %49, double %51)
%53 = getelementptr inbounds double, double* %3, i64 4
%54 = load double, double* %53
%55 = getelementptr inbounds double, double* %4, i64 4
%56 = load double, double* %55
%57 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 4, double %54, double %56)
%58 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %59
59: ; preds = %5, %7
ret void
}