#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*/ car_dyanmics(double *, double *);
int /*<<< orphan*/ car_dyanmics_jacobian(double *, double *);
void myfevals(double *x, double *y, double *l, double *p, double *f,
              double *nabla_f, double *c, double *nabla_c, double *h,
              double *nabla_h, double *H, int stage) {
  if (f) {
    (*f) += -100 * x[3] + 0.1 * x[0] * x[0] + 0.01 * x[1] * x[1];
  }
  if (nabla_f) {
    nabla_f[0] = 0.2 * x[0];
    nabla_f[1] = 0.02 * x[1];
    nabla_f[3] = -100;
  }
  if (c) {
    car_dyanmics(x, c);
  }
  if (nabla_c) {
    car_dyanmics_jacobian(x, nabla_c);
  }
  if (h) {
    h[0] = x[2] * x[2] + x[3] * x[3];
    h[1] = (x[2] + 2) * (x[2] + 2) + (x[3] - 2.5) * (x[3] - 2.5);
  }
  if (nabla_h) {
    nabla_h[4] = 2 * x[2];
    nabla_h[5] = 2 * x[2] + 4;
    nabla_h[6] = 2 * x[3];
    nabla_h[7] = 2 * x[3] - 5;
  }
}


x86 assembly (clang, -O0):
<myfevals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11c1 <myfevals+0xa1>
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0xe99(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  0xe7d(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0xe61(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
cmpq   $0x0,-0x30(%rbp)
je     120f <myfevals+0xef>
mov    -0x8(%rbp),%rax
movsd  0xe48(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0xe28(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x30(%rbp),%rax
movsd  0xdfe(%rip),%xmm0
movsd  %xmm0,0x18(%rax)
cmpq   $0x0,0x10(%rbp)
je     1227 <myfevals+0x107>
mov    -0x8(%rbp),%rdi
mov    0x10(%rbp),%rsi
call   1030 <car_dyanmics@plt>
cmpq   $0x0,0x18(%rbp)
je     123f <myfevals+0x11f>
mov    -0x8(%rbp),%rdi
mov    0x18(%rbp),%rsi
call   1040 <car_dyanmics_jacobian@plt>
cmpq   $0x0,0x20(%rbp)
je     12df <myfevals+0x1bf>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0xda6(%rip),%xmm0
addsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0xd95(%rip),%xmm2
addsd  0x10(%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm1
movsd  0xd77(%rip),%xmm3
subsd  %xmm3,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm3
movsd  0xd62(%rip),%xmm4
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
cmpq   $0x0,0x28(%rbp)
je     1362 <myfevals+0x242>
mov    -0x8(%rbp),%rax
movsd  0xd3a(%rip),%xmm0
mulsd  0x10(%rax),%xmm0
mov    0x28(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
addsd  %xmm0,%xmm0
movsd  0xd27(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    0x28(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
movsd  0xcfe(%rip),%xmm0
mulsd  0x18(%rax),%xmm0
mov    0x28(%rbp),%rax
movsd  %xmm0,0x30(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
addsd  %xmm0,%xmm0
movsd  0xce3(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    0x28(%rbp),%rax
movsd  %xmm0,0x38(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myfevals>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
test   %r8,%r8
je     1175 <myfevals+0x55>
movsd  0x18(%rbx),%xmm0
movsd  (%rbx),%xmm1
movsd  0x8(%rbx),%xmm2
movsd  0xebd(%rip),%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm1,%xmm3
mulsd  0xeb5(%rip),%xmm0
addsd  %xmm3,%xmm0
movsd  0xeb1(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
addsd  (%r8),%xmm1
movsd  %xmm1,(%r8)
mov    0x20(%rsp),%rsi
test   %r9,%r9
je     11b1 <myfevals+0x91>
movsd  (%rbx),%xmm0
mulsd  0xe8d(%rip),%xmm0
movsd  %xmm0,(%r9)
movsd  0x8(%rbx),%xmm0
mulsd  0xe83(%rip),%xmm0
movsd  %xmm0,0x8(%r9)
movabs $0xc059000000000000,%rax
mov    %rax,0x18(%r9)
mov    0x28(%rsp),%r14
test   %rsi,%rsi
je     11c3 <myfevals+0xa3>
mov    %rbx,%rdi
call   1030 <car_dyanmics@plt>
mov    0x30(%rsp),%r15
test   %r14,%r14
je     11d8 <myfevals+0xb8>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <car_dyanmics_jacobian@plt>
mov    0x38(%rsp),%rax
test   %r15,%r15
je     1229 <myfevals+0x109>
movsd  0x10(%rbx),%xmm0
movsd  0x18(%rbx),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
movsd  0x10(%rbx),%xmm0
movsd  0x18(%rbx),%xmm1
addsd  0xe19(%rip),%xmm0
addsd  0xe19(%rip),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r15)
test   %rax,%rax
je     1276 <myfevals+0x156>
movsd  0x10(%rbx),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rax)
movsd  0x10(%rbx),%xmm0
addsd  %xmm0,%xmm0
addsd  0xdeb(%rip),%xmm0
movsd  %xmm0,0x28(%rax)
movsd  0x18(%rbx),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x30(%rax)
movsd  0x18(%rbx),%xmm0
addsd  %xmm0,%xmm0
addsd  0xdcf(%rip),%xmm0
movsd  %xmm0,0x38(%rax)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @myfevals(double* %0, double* nocapture readnone %1, double* nocapture readnone %2, double* nocapture readnone %3, double* %4, double* writeonly %5, double* %6, double* %7, double* writeonly %8, double* writeonly %9, double* nocapture readnone %10, i32 %11) {
%13 = icmp eq double* %4, null
br i1 %13, label %27, label %14
14: ; preds = %12
%15 = getelementptr inbounds double, double* %0, i64 3
%16 = load double, double* %15
%17 = load double, double* %0
%18 = fmul double %17, 1.000000e-01
%19 = fmul double %17, %18
%20 = tail call double @llvm.fmuladd.f64(double %16, double -1.000000e+02, double %19)
%21 = getelementptr inbounds double, double* %0, i64 1
%22 = load double, double* %21
%23 = fmul double %22, 1.000000e-02
%24 = tail call double @llvm.fmuladd.f64(double %23, double %22, double %20)
%25 = load double, double* %4
%26 = fadd double %25, %24
store double %26, double* %4
br label %27
27: ; preds = %14, %12
%28 = icmp eq double* %5, null
br i1 %28, label %37, label %29
29: ; preds = %27
%30 = load double, double* %0
%31 = fmul double %30, 2.000000e-01
store double %31, double* %5
%32 = getelementptr inbounds double, double* %0, i64 1
%33 = load double, double* %32
%34 = fmul double %33, 2.000000e-02
%35 = getelementptr inbounds double, double* %5, i64 1
store double %34, double* %35
%36 = getelementptr inbounds double, double* %5, i64 3
store double -1.000000e+02, double* %36
br label %37
37: ; preds = %29, %27
%38 = icmp eq double* %6, null
br i1 %38, label %41, label %39
39: ; preds = %37
%40 = tail call i32 @car_dyanmics(double* %0, double* %6)
br label %41
41: ; preds = %39, %37
%42 = icmp eq double* %7, null
br i1 %42, label %45, label %43
43: ; preds = %41
%44 = tail call i32 @car_dyanmics_jacobian(double* %0, double* %7)
br label %45
45: ; preds = %43, %41
%46 = icmp eq double* %8, null
br i1 %46, label %61, label %47
47: ; preds = %45
%48 = getelementptr inbounds double, double* %0, i64 2
%49 = load double, double* %48
%50 = getelementptr inbounds double, double* %0, i64 3
%51 = load double, double* %50
%52 = fmul double %51, %51
%53 = tail call double @llvm.fmuladd.f64(double %49, double %49, double %52)
store double %53, double* %8
%54 = load double, double* %48
%55 = fadd double %54, 2.000000e+00
%56 = load double, double* %50
%57 = fadd double %56, -2.500000e+00
%58 = fmul double %57, %57
%59 = tail call double @llvm.fmuladd.f64(double %55, double %55, double %58)
%60 = getelementptr inbounds double, double* %8, i64 1
store double %59, double* %60
br label %61
61: ; preds = %47, %45
%62 = icmp eq double* %9, null
br i1 %62, label %78, label %63
63: ; preds = %61
%64 = getelementptr inbounds double, double* %0, i64 2
%65 = load double, double* %64
%66 = fmul double %65, 2.000000e+00
%67 = getelementptr inbounds double, double* %9, i64 4
store double %66, double* %67
%68 = load double, double* %64
%69 = tail call double @llvm.fmuladd.f64(double %68, double 2.000000e+00, double 4.000000e+00)
%70 = getelementptr inbounds double, double* %9, i64 5
store double %69, double* %70
%71 = getelementptr inbounds double, double* %0, i64 3
%72 = load double, double* %71
%73 = fmul double %72, 2.000000e+00
%74 = getelementptr inbounds double, double* %9, i64 6
store double %73, double* %74
%75 = load double, double* %71
%76 = tail call double @llvm.fmuladd.f64(double %75, double 2.000000e+00, double -5.000000e+00)
%77 = getelementptr inbounds double, double* %9, i64 7
store double %76, double* %77
br label %78
78: ; preds = %63, %61
ret void
}