#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*/ rlk_f(double *, double *, double *, double);
void rulkov_map(int dim, double dt, double *vars, double *params, double syn) {
  double ret[2];
  if (params[4] >= ((params[6] - 400) / 400)) {
    params[5] = vars[0];
    rlk_f(vars, ret, params, syn);
    params[4] = 0;
    params[7] = ret[0];
    vars[0] = ret[0];
    vars[1] = ret[1];
  }
  ret[0] = params[5] +
           (params[7] - params[5]) / ((params[6] - 400) / 400) * params[4];
  ret[1] = vars[1];
  params[4]++;
  vars[0] = ret[0];
  vars[1] = ret[1];
  return;
}


x86 assembly (clang, -O0):
<rulkov_map>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  0x30(%rax),%xmm1
movsd  0xeb9(%rip),%xmm2
subsd  %xmm2,%xmm1
movsd  0xead(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jb     11bd <rulkov_map+0xad>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x18(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x20(%rbp),%rdx
movsd  -0x28(%rbp),%xmm0
call   1030 <rlk_f@plt>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x20(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x38(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movsd  0x28(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  0x28(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  0x30(%rax),%xmm2
movsd  0xe17(%rip),%xmm3
subsd  %xmm3,%xmm2
movsd  0xe0b(%rip),%xmm3
divsd  %xmm3,%xmm2
divsd  %xmm2,%xmm0
mov    -0x20(%rbp),%rax
movsd  0x20(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rax
movsd  0xddb(%rip),%xmm0
addsd  0x20(%rax),%xmm0
movsd  %xmm0,0x20(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rulkov_map>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
movsd  0x20(%rdx),%xmm0
movsd  0x30(%rdx),%xmm2
addsd  0xed1(%rip),%xmm2
divsd  0xed1(%rip),%xmm2
ucomisd %xmm2,%xmm0
jae    1145 <rulkov_map+0x35>
movsd  0x8(%r14),%xmm1
jmp    1191 <rulkov_map+0x81>
movsd  (%r14),%xmm0
movsd  %xmm0,0x28(%rbx)
mov    %rsp,%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
movaps %xmm1,%xmm0
call   1030 <rlk_f@plt>
movq   $0x0,0x20(%rbx)
movaps (%rsp),%xmm1
movlps %xmm1,0x38(%rbx)
movups %xmm1,(%r14)
movsd  0x30(%rbx),%xmm2
addsd  0xe7f(%rip),%xmm2
movsd  0x20(%rbx),%xmm0
divsd  0xe7a(%rip),%xmm2
movhlps %xmm1,%xmm1
movsd  0x28(%rbx),%xmm3
movsd  0x38(%rbx),%xmm4
subsd  %xmm3,%xmm4
divsd  %xmm2,%xmm4
mulsd  %xmm0,%xmm4
addsd  0xe61(%rip),%xmm0
addsd  %xmm3,%xmm4
movsd  %xmm0,0x20(%rbx)
movsd  %xmm4,(%r14)
movsd  %xmm1,0x8(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @rulkov_map(i32 %0, double %1, double* %2, double* %3, double %4) {
%6 = alloca i32
%7 = alloca double
%8 = alloca double*
%9 = alloca double*
%10 = alloca double
%11 = alloca [2 x double]
store i32 %0, i32* %6
store double %1, double* %7
store double* %2, double** %8
store double* %3, double** %9
store double %4, double* %10
%12 = load double*, double** %9
%13 = getelementptr inbounds double, double* %12, i64 4
%14 = load double, double* %13
%15 = load double*, double** %9
%16 = getelementptr inbounds double, double* %15, i64 6
%17 = load double, double* %16
%18 = fsub double %17, 4.000000e+02
%19 = fdiv double %18, 4.000000e+02
%20 = fcmp oge double %14, %19
br i1 %20, label %21, label %46
21: ; preds = %5
%22 = load double*, double** %8
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = load double*, double** %9
%26 = getelementptr inbounds double, double* %25, i64 5
store double %24, double* %26
%27 = load double*, double** %8
%28 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%29 = load double*, double** %9
%30 = load double, double* %10
%31 = call i32 @rlk_f(double* %27, double* %28, double* %29, double %30)
%32 = load double*, double** %9
%33 = getelementptr inbounds double, double* %32, i64 4
store double 0.000000e+00, double* %33
%34 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%35 = load double, double* %34
%36 = load double*, double** %9
%37 = getelementptr inbounds double, double* %36, i64 7
store double %35, double* %37
%38 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%39 = load double, double* %38
%40 = load double*, double** %8
%41 = getelementptr inbounds double, double* %40, i64 0
store double %39, double* %41
%42 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 1
%43 = load double, double* %42
%44 = load double*, double** %8
%45 = getelementptr inbounds double, double* %44, i64 1
store double %43, double* %45
br label %46
46: ; preds = %21, %5
%47 = load double*, double** %9
%48 = getelementptr inbounds double, double* %47, i64 5
%49 = load double, double* %48
%50 = load double*, double** %9
%51 = getelementptr inbounds double, double* %50, i64 7
%52 = load double, double* %51
%53 = load double*, double** %9
%54 = getelementptr inbounds double, double* %53, i64 5
%55 = load double, double* %54
%56 = fsub double %52, %55
%57 = load double*, double** %9
%58 = getelementptr inbounds double, double* %57, i64 6
%59 = load double, double* %58
%60 = fsub double %59, 4.000000e+02
%61 = fdiv double %60, 4.000000e+02
%62 = fdiv double %56, %61
%63 = load double*, double** %9
%64 = getelementptr inbounds double, double* %63, i64 4
%65 = load double, double* %64
%66 = call double @llvm.fmuladd.f64(double %62, double %65, double %49)
%67 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
store double %66, double* %67
%68 = load double*, double** %8
%69 = getelementptr inbounds double, double* %68, i64 1
%70 = load double, double* %69
%71 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 1
store double %70, double* %71
%72 = load double*, double** %9
%73 = getelementptr inbounds double, double* %72, i64 4
%74 = load double, double* %73
%75 = fadd double %74, 1.000000e+00
store double %75, double* %73
%76 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 0
%77 = load double, double* %76
%78 = load double*, double** %8
%79 = getelementptr inbounds double, double* %78, i64 0
store double %77, double* %79
%80 = getelementptr inbounds [2 x double], [2 x double]* %11, i64 0, i64 1
%81 = load double, double* %80
%82 = load double*, double** %8
%83 = getelementptr inbounds double, double* %82, i64 1
store double %81, double* %83
ret void
}

LLVM IR (-O2):
define void @rulkov_map(i32 %0, double %1, double* %2, double* %3, double %4) {
%6 = alloca <2 x double>
%7 = bitcast <2 x double>* %6 to i8*
%8 = getelementptr inbounds double, double* %3, i64 4
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %3, i64 6
%11 = load double, double* %10
%12 = fadd double %11, -4.000000e+02
%13 = fdiv double %12, 4.000000e+02
%14 = fcmp ult double %9, %13
br i1 %14, label %15, label %18
15: ; preds = %5
%16 = getelementptr inbounds double, double* %2, i64 1
%17 = load double, double* %16
br label %32
18: ; preds = %5
%19 = load double, double* %2
%20 = getelementptr inbounds double, double* %3, i64 5
store double %19, double* %20
%21 = getelementptr inbounds <2 x double>, <2 x double>* %6, i64 0, i64 0
%22 = call i32 @rlk_f(double* %2, double* %21, double* %3, double %4)
store double 0.000000e+00, double* %8
%23 = getelementptr inbounds double, double* %3, i64 7
%24 = load <2 x double>, <2 x double>* %6
%25 = extractelement <2 x double> %24, i64 0
store double %25, double* %23
%26 = bitcast double* %2 to <2 x double>*
store <2 x double> %24, <2 x double>* %26
%27 = load double, double* %10
%28 = load double, double* %8
%29 = fadd double %27, -4.000000e+02
%30 = fdiv double %29, 4.000000e+02
%31 = extractelement <2 x double> %24, i64 1
br label %32
32: ; preds = %15, %18
%33 = phi double [ %13, %15 ], [ %30, %18 ]
%34 = phi double [ %17, %15 ], [ %31, %18 ]
%35 = phi double [ %9, %15 ], [ %28, %18 ]
%36 = getelementptr inbounds double, double* %3, i64 5
%37 = load double, double* %36
%38 = getelementptr inbounds double, double* %3, i64 7
%39 = load double, double* %38
%40 = fsub double %39, %37
%41 = fdiv double %40, %33
%42 = call double @llvm.fmuladd.f64(double %41, double %35, double %37)
%43 = getelementptr inbounds double, double* %2, i64 1
%44 = fadd double %35, 1.000000e+00
store double %44, double* %8
store double %42, double* %2
store double %34, double* %43
ret void
}