#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 floor(int const);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int const);
void interp1_table0_real_per_adj(double *r_ck, double *i_ck, const int K1,
                                 const double *r_h1, const int J1, const int L1,
                                 const double *p_tm, const int M,
                                 const double *r_fm, const double *i_fm) {
  (void)memset((void *)r_ck, 0, K1 * sizeof(*r_ck));
  (void)memset((void *)i_ck, 0, K1 * sizeof(*i_ck));
  {
    const int ncenter1 = floor(J1 * L1 / 2.);
    r_h1 += ncenter1;
  }
  for (int mm = 0; mm < M; mm++) {
    const double t1 = *p_tm++;
    const double fmr = *r_fm++;
    const double fmi = *i_fm++;
    int k1 = 1 + floor(t1 - J1 / 2.);
    for (int jj1 = 0; jj1 < J1; jj1++, k1++) {
      const double p1 = (t1 - k1) * L1;
      const int n1 = floor(p1 + 0.5);
      register double coef1r = r_h1[n1];
      const int wrap1 = floor(k1 / (double)K1);
      const int k1mod = k1 - K1 * wrap1;
      r_ck[k1mod] += coef1r * fmr;
      i_ck[k1mod] += coef1r * fmi;
    }
  }
}


x86 assembly (clang, -O0):
<interp1_table0_real_per_adj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x24(%rbp),%eax
imul   -0x28(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe75(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    1329 <interp1_table0_real_per_adj+0x209>
mov    0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,0x10(%rbp)
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,0x20(%rbp)
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,0x28(%rbp)
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  0xde3(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1316 <interp1_table0_real_per_adj+0x1f6>
movsd  -0x38(%rbp),%xmm0
cvtsi2sdl -0x4c(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xd9d(%rip),%xmm0
addsd  -0x58(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
cvtsi2sdl -0x4c(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x6c(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x68(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    123b <interp1_table0_real_per_adj+0x11b>
jmp    131b <interp1_table0_real_per_adj+0x1fb>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11b7 <interp1_table0_real_per_adj+0x97>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interp1_table0_real_per_adj>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9d,%r12d
mov    %r8d,%r14d
mov    %rcx,0x10(%rsp)
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rdx,0x20(%rsp)
lea    0x0(,%rdx,8),%r13d
xor    %ebp,%ebp
xor    %esi,%esi
mov    %r13d,%edx
call   1030 <memset@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %r13d,%edx
call   1030 <memset@plt>
mov    %r12d,%eax
mov    %r14d,0xc(%rsp)
imul   %r14d,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xe83(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
cmpl   $0x0,0xb8(%rsp)
jle    1345 <interp1_table0_real_per_adj+0x225>
mov    0xc8(%rsp),%rcx
mov    0xc0(%rsp),%rdx
mov    0xb0(%rsp),%rsi
cltq
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
mulsd  0xe41(%rip),%xmm0
movsd  %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
movsd  %xmm0,0x28(%rsp)
mov    0x10(%rsp),%rdi
lea    (%rdi,%rax,8),%r13
xorps  %xmm0,%xmm0
cvtsi2sdl 0x20(%rsp),%xmm0
movsd  %xmm0,0x50(%rsp)
jmp    121f <interp1_table0_real_per_adj+0xff>
nopl   (%rax)
mov    0x38(%rsp),%rsi
add    $0x8,%rsi
mov    0x40(%rsp),%rdx
add    $0x8,%rdx
mov    0x48(%rsp),%rcx
add    $0x8,%rcx
mov    0x1c(%rsp),%ebp
add    $0x1,%ebp
cmp    0xb8(%rsp),%ebp
je     1345 <interp1_table0_real_per_adj+0x225>
mov    %ebp,0x1c(%rsp)
mov    %rsi,0x38(%rsp)
movsd  (%rsi),%xmm0
mov    %rdx,0x40(%rsp)
movsd  (%rdx),%xmm1
movsd  %xmm1,0x60(%rsp)
mov    %rcx,0x48(%rsp)
movsd  (%rcx),%xmm1
movsd  %xmm1,0x58(%rsp)
movsd  %xmm0,0x68(%rsp)
subsd  0x30(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
cmpl   $0x0,0xc(%rsp)
mov    0x20(%rsp),%rbp
movsd  0x28(%rsp),%xmm1
movsd  0xd89(%rip),%xmm2
jle    11f0 <interp1_table0_real_per_adj+0xd0>
add    $0x1,%eax
movslq %eax,%r14
mov    0xc(%rsp),%r12d
nopl   0x0(%rax,%rax,1)
xorps  %xmm3,%xmm3
cvtsi2sd %r14d,%xmm3
movsd  %xmm3,0x70(%rsp)
movsd  0x68(%rsp),%xmm0
subsd  %xmm3,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
cltq
movsd  0x0(%r13,%rax,8),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x70(%rsp),%xmm0
divsd  0x50(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <floor@plt>
movsd  0xd1b(%rip),%xmm2
movsd  0x28(%rsp),%xmm1
imul   %ebp,%eax
cltq
shl    $0x3,%rax
mov    %rbx,%rcx
sub    %rax,%rcx
movsd  0x10(%rsp),%xmm3
movapd %xmm3,%xmm0
mulsd  0x60(%rsp),%xmm0
addsd  (%rcx,%r14,8),%xmm0
movsd  %xmm0,(%rcx,%r14,8)
mov    %r15,%rcx
sub    %rax,%rcx
movapd %xmm3,%xmm0
mulsd  0x58(%rsp),%xmm0
addsd  (%rcx,%r14,8),%xmm0
movsd  %xmm0,(%rcx,%r14,8)
add    $0x1,%r14
add    $0xffffffff,%r12d
jne    1290 <interp1_table0_real_per_adj+0x170>
jmp    11f0 <interp1_table0_real_per_adj+0xd0>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @interp1_table0_real_per_adj(double* %0, double* %1, i32 %2, double* %3, i32 %4, i32 %5, double* %6, i32 %7, double* %8, double* %9) {
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca double*
%15 = alloca i32
%16 = alloca i32
%17 = alloca double*
%18 = alloca i32
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32
%22 = alloca i32
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca i32
%27 = alloca i32
%28 = alloca double
%29 = alloca i32
%30 = alloca double
%31 = alloca i32
%32 = alloca i32
store double* %0, double** %11
store double* %1, double** %12
store i32 %2, i32* %13
store double* %3, double** %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store double* %6, double** %17
store i32 %7, i32* %18
store double* %8, double** %19
store double* %9, double** %20
%33 = load double*, double** %11
%34 = bitcast double* %33 to i8*
%35 = load i32, i32* %13
%36 = sext i32 %35 to i64
%37 = mul i64 %36, 8
%38 = trunc i64 %37 to i32
%39 = call i32 @memset(i8* %34, i32 0, i32 %38)
%40 = load double*, double** %12
%41 = bitcast double* %40 to i8*
%42 = load i32, i32* %13
%43 = sext i32 %42 to i64
%44 = mul i64 %43, 8
%45 = trunc i64 %44 to i32
%46 = call i32 @memset(i8* %41, i32 0, i32 %45)
%47 = load i32, i32* %15
%48 = load i32, i32* %16
%49 = mul nsw i32 %47, %48
%50 = sitofp i32 %49 to double
%51 = fdiv double %50, 2.000000e+00
%52 = fptosi double %51 to i32
%53 = call i32 @floor(i32 %52)
store i32 %53, i32* %21
%54 = load i32, i32* %21
%55 = load double*, double** %14
%56 = sext i32 %54 to i64
%57 = getelementptr inbounds double, double* %55, i64 %56
store double* %57, double** %14
store i32 0, i32* %22
br label %58
58: ; preds = %135, %10
%59 = load i32, i32* %22
%60 = load i32, i32* %18
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %138
62: ; preds = %58
%63 = load double*, double** %17
%64 = getelementptr inbounds double, double* %63, i32 1
store double* %64, double** %17
%65 = load double, double* %63
store double %65, double* %23
%66 = load double*, double** %19
%67 = getelementptr inbounds double, double* %66, i32 1
store double* %67, double** %19
%68 = load double, double* %66
store double %68, double* %24
%69 = load double*, double** %20
%70 = getelementptr inbounds double, double* %69, i32 1
store double* %70, double** %20
%71 = load double, double* %69
store double %71, double* %25
%72 = load double, double* %23
%73 = load i32, i32* %15
%74 = sitofp i32 %73 to double
%75 = fdiv double %74, 2.000000e+00
%76 = fsub double %72, %75
%77 = fptosi double %76 to i32
%78 = call i32 @floor(i32 %77)
%79 = add nsw i32 1, %78
store i32 %79, i32* %26
store i32 0, i32* %27
br label %80
80: ; preds = %129, %62
%81 = load i32, i32* %27
%82 = load i32, i32* %15
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %134
84: ; preds = %80
%85 = load double, double* %23
%86 = load i32, i32* %26
%87 = sitofp i32 %86 to double
%88 = fsub double %85, %87
%89 = load i32, i32* %16
%90 = sitofp i32 %89 to double
%91 = fmul double %88, %90
store double %91, double* %28
%92 = load double, double* %28
%93 = fadd double %92, 5.000000e-01
%94 = fptosi double %93 to i32
%95 = call i32 @floor(i32 %94)
store i32 %95, i32* %29
%96 = load double*, double** %14
%97 = load i32, i32* %29
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds double, double* %96, i64 %98
%100 = load double, double* %99
store double %100, double* %30
%101 = load i32, i32* %26
%102 = sitofp i32 %101 to double
%103 = load i32, i32* %13
%104 = sitofp i32 %103 to double
%105 = fdiv double %102, %104
%106 = fptosi double %105 to i32
%107 = call i32 @floor(i32 %106)
store i32 %107, i32* %31
%108 = load i32, i32* %26
%109 = load i32, i32* %13
%110 = load i32, i32* %31
%111 = mul nsw i32 %109, %110
%112 = sub nsw i32 %108, %111
store i32 %112, i32* %32
%113 = load double, double* %30
%114 = load double, double* %24
%115 = load double*, double** %11
%116 = load i32, i32* %32
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %115, i64 %117
%119 = load double, double* %118
%120 = call double @llvm.fmuladd.f64(double %113, double %114, double %119)
store double %120, double* %118
%121 = load double, double* %30
%122 = load double, double* %25
%123 = load double*, double** %12
%124 = load i32, i32* %32
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %123, i64 %125
%127 = load double, double* %126
%128 = call double @llvm.fmuladd.f64(double %121, double %122, double %127)
store double %128, double* %126
br label %129
129: ; preds = %84
%130 = load i32, i32* %27
%131 = add nsw i32 %130, 1
store i32 %131, i32* %27
%132 = load i32, i32* %26
%133 = add nsw i32 %132, 1
store i32 %133, i32* %26
br label %80
134: ; preds = %80
br label %135
135: ; preds = %134
%136 = load i32, i32* %22
%137 = add nsw i32 %136, 1
store i32 %137, i32* %22
br label %58
138: ; preds = %58
ret void
}

LLVM IR (-O2):
define void @interp1_table0_real_per_adj(double* %0, double* %1, i32 %2, double* nocapture %3, i32 %4, i32 %5, double* nocapture %6, i32 %7, double* nocapture %8, double* nocapture %9) {
%11 = bitcast double* %0 to i8*
%12 = shl i32 %2, 3
%13 = tail call i32 @memset(i8* %11, i32 0, i32 %12)
%14 = bitcast double* %1 to i8*
%15 = tail call i32 @memset(i8* %14, i32 0, i32 %12)
%16 = mul nsw i32 %5, %4
%17 = sitofp i32 %16 to double
%18 = fmul double %17, 5.000000e-01
%19 = fptosi double %18 to i32
%20 = tail call i32 @floor(i32 %19)
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %3, i64 %21
%23 = icmp sgt i32 %7, 0
br i1 %23, label %24, label %30
24: ; preds = %10
%25 = sitofp i32 %4 to double
%26 = fmul double %25, 5.000000e-01
%27 = icmp sgt i32 %4, 0
%28 = sitofp i32 %5 to double
%29 = sitofp i32 %2 to double
br label %31
30: ; preds = %45, %10
ret void
31: ; preds = %24, %45
%32 = phi double* [ %6, %24 ], [ %36, %45 ]
%33 = phi double* [ %8, %24 ], [ %38, %45 ]
%34 = phi double* [ %9, %24 ], [ %40, %45 ]
%35 = phi i32 [ 0, %24 ], [ %46, %45 ]
%36 = getelementptr inbounds double, double* %32, i64 1
%37 = load double, double* %32
%38 = getelementptr inbounds double, double* %33, i64 1
%39 = load double, double* %33
%40 = getelementptr inbounds double, double* %34, i64 1
%41 = load double, double* %34
%42 = fsub double %37, %26
%43 = fptosi double %42 to i32
%44 = tail call i32 @floor(i32 %43)
br i1 %27, label %48, label %45
45: ; preds = %48, %31
%46 = add nuw nsw i32 %35, 1
%47 = icmp eq i32 %46, %7
br i1 %47, label %30, label %31
48: ; preds = %31, %48
%49 = phi i32 [ %51, %48 ], [ %44, %31 ]
%50 = phi i32 [ %73, %48 ], [ 0, %31 ]
%51 = add nsw i32 %49, 1
%52 = sitofp i32 %51 to double
%53 = fsub double %37, %52
%54 = fmul double %53, %28
%55 = fadd double %54, 5.000000e-01
%56 = fptosi double %55 to i32
%57 = tail call i32 @floor(i32 %56)
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %22, i64 %58
%60 = load double, double* %59
%61 = fdiv double %52, %29
%62 = fptosi double %61 to i32
%63 = tail call i32 @floor(i32 %62)
%64 = mul nsw i32 %63, %2
%65 = sub nsw i32 %51, %64
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %0, i64 %66
%68 = load double, double* %67
%69 = tail call double @llvm.fmuladd.f64(double %60, double %39, double %68)
store double %69, double* %67
%70 = getelementptr inbounds double, double* %1, i64 %66
%71 = load double, double* %70
%72 = tail call double @llvm.fmuladd.f64(double %60, double %41, double %71)
store double %72, double* %70
%73 = add nuw nsw i32 %50, 1
%74 = icmp eq i32 %73, %4
br i1 %74, label %45, label %48
}