#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 */
float dichotomy_inv_incfunc(float, float, float, float, float (*)(float));
float *malloc(int);
int /*<<< orphan*/ sarerror_msg(char *, float);
float *lookuptable_inv_incfunc(float y_min, float y_max, int nb,
                               float precision, float x_min, float x_max,
                               float (*func)(float)) {
  float step = (y_max - y_min) / (nb - 1);
  float y;
  float y_min_INF = func(x_min);
  float y_max_SUP = func(x_max);
  if (y_min < y_min_INF) {
    sarerror_msg("Minimum bounds too small (cannot be inferior to %.4g)",
                 y_min_INF);
    return NULL;
  }
  if (y_max > y_max_SUP) {
    sarerror_msg("Maximum bounds too big (cannot be superior to %.4g)",
                 y_max_SUP);
    return NULL;
  }
  float *res = malloc(nb * sizeof(float));
  int k;
  for (k = 0; k < nb; ++k) {
    y = y_min + k * step * y_max;
    res[k] = dichotomy_inv_incfunc(x_min, x_max, y, precision, func);
    x_min = res[k];
  }
  return res;
}


x86 assembly (clang, -O0):
<lookuptable_inv_incfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movss  %xmm2,-0x18(%rbp)
movss  %xmm3,-0x1c(%rbp)
movss  %xmm4,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
movss  -0x1c(%rbp),%xmm0
call   *%rax
movss  %xmm0,-0x34(%rbp)
mov    -0x28(%rbp),%rax
movss  -0x20(%rbp),%xmm0
call   *%rax
movss  %xmm0,-0x38(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x34(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11c6 <lookuptable_inv_incfunc+0x96>
movss  -0x34(%rbp),%xmm0
lea    0xe4c(%rip),%rdi
call   1030 <sarerror_msg@plt>
movq   $0x0,-0x8(%rbp)
jmp    128c <lookuptable_inv_incfunc+0x15c>
movss  -0x10(%rbp),%xmm0
ucomiss -0x38(%rbp),%xmm0
jbe    11f3 <lookuptable_inv_incfunc+0xc3>
movss  -0x38(%rbp),%xmm0
lea    0xe55(%rip),%rdi
call   1030 <sarerror_msg@plt>
movq   $0x0,-0x8(%rbp)
jmp    128c <lookuptable_inv_incfunc+0x15c>
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1284 <lookuptable_inv_incfunc+0x154>
movss  -0xc(%rbp),%xmm1
cvtsi2ssl -0x44(%rbp),%xmm0
mulss  -0x2c(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
movss  -0x30(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
mov    -0x28(%rbp),%rdi
call   1040 <dichotomy_inv_incfunc@plt>
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    120d <lookuptable_inv_incfunc+0xdd>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookuptable_inv_incfunc>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
movss  %xmm4,0xc(%rsp)
movss  %xmm2,0x14(%rsp)
mov    %edi,%r15d
movss  %xmm1,0x4(%rsp)
movss  %xmm0,0x8(%rsp)
movss  %xmm3,0x10(%rsp)
movaps %xmm3,%xmm0
call   *%rsi
movss  %xmm0,(%rsp)
movss  0xc(%rsp),%xmm0
call   *%r14
movss  (%rsp),%xmm1
movss  0x8(%rsp),%xmm2
ucomiss %xmm2,%xmm1
jbe    118e <lookuptable_inv_incfunc+0x5e>
lea    0xe77(%rip),%rdi
movaps %xmm1,%xmm0
jmp    11a0 <lookuptable_inv_incfunc+0x70>
movss  0x4(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    11b7 <lookuptable_inv_incfunc+0x87>
lea    0xe96(%rip),%rdi
call   1030 <sarerror_msg@plt>
xor    %r12d,%r12d
mov    %r12,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0x0(,%r15,4),%edi
call   1050 <malloc@plt>
mov    %rax,%r12
test   %r15d,%r15d
jle    11a8 <lookuptable_inv_incfunc+0x78>
movss  0x4(%rsp),%xmm1
movaps %xmm1,%xmm2
lea    -0x1(%r15),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0x8(%rsp),%xmm3
subss  %xmm3,%xmm2
divss  %xmm0,%xmm2
movss  %xmm2,(%rsp)
mov    %r15d,%r15d
xor    %ebx,%ebx
movss  0x10(%rsp),%xmm0
xchg   %ax,%ax
xorps  %xmm2,%xmm2
cvtsi2ss %ebx,%xmm2
mulss  (%rsp),%xmm2
mulss  %xmm1,%xmm2
addss  %xmm3,%xmm2
movss  0xc(%rsp),%xmm1
movss  0x14(%rsp),%xmm3
mov    %r14,%rdi
call   1040 <dichotomy_inv_incfunc@plt>
movss  0x8(%rsp),%xmm3
movss  0x4(%rsp),%xmm1
movss  %xmm0,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1200 <lookuptable_inv_incfunc+0xd0>
jmp    11a8 <lookuptable_inv_incfunc+0x78>

LLVM IR (-O0):
@.str = [54 x i8] c"Minimum bounds too small (cannot be inferior to %.4g)\00"
@.str.1 = [52 x i8] c"Maximum bounds too big (cannot be superior to %.4g)\00"
define float* @lookuptable_inv_incfunc(float %0, float %1, i32 %2, float %3, float %4, float %5, float (float)* %6) {
%8 = alloca float*
%9 = alloca float
%10 = alloca float
%11 = alloca i32
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float (float)*
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float*
%21 = alloca i32
store float %0, float* %9
store float %1, float* %10
store i32 %2, i32* %11
store float %3, float* %12
store float %4, float* %13
store float %5, float* %14
store float (float)* %6, float (float)** %15
%22 = load float, float* %10
%23 = load float, float* %9
%24 = fsub float %22, %23
%25 = load i32, i32* %11
%26 = sub nsw i32 %25, 1
%27 = sitofp i32 %26 to float
%28 = fdiv float %24, %27
store float %28, float* %16
%29 = load float (float)*, float (float)** %15
%30 = load float, float* %13
%31 = call float %29(float %30)
store float %31, float* %18
%32 = load float (float)*, float (float)** %15
%33 = load float, float* %14
%34 = call float %32(float %33)
store float %34, float* %19
%35 = load float, float* %9
%36 = load float, float* %18
%37 = fcmp olt float %35, %36
br i1 %37, label %38, label %41
38: ; preds = %7
%39 = load float, float* %18
%40 = call i32 @sarerror_msg(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), float %39)
store float* null, float** %8
br label %86
41: ; preds = %7
%42 = load float, float* %10
%43 = load float, float* %19
%44 = fcmp ogt float %42, %43
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = load float, float* %19
%47 = call i32 @sarerror_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), float %46)
store float* null, float** %8
br label %86
48: ; preds = %41
%49 = load i32, i32* %11
%50 = sext i32 %49 to i64
%51 = mul i64 %50, 4
%52 = trunc i64 %51 to i32
%53 = call float* @malloc(i32 %52)
store float* %53, float** %20
store i32 0, i32* %21
br label %54
54: ; preds = %81, %48
%55 = load i32, i32* %21
%56 = load i32, i32* %11
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %84
58: ; preds = %54
%59 = load float, float* %9
%60 = load i32, i32* %21
%61 = sitofp i32 %60 to float
%62 = load float, float* %16
%63 = fmul float %61, %62
%64 = load float, float* %10
%65 = call float @llvm.fmuladd.f32(float %63, float %64, float %59)
store float %65, float* %17
%66 = load float, float* %13
%67 = load float, float* %14
%68 = load float, float* %17
%69 = load float, float* %12
%70 = load float (float)*, float (float)** %15
%71 = call float @dichotomy_inv_incfunc(float %66, float %67, float %68, float %69, float (float)* %70)
%72 = load float*, float** %20
%73 = load i32, i32* %21
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds float, float* %72, i64 %74
store float %71, float* %75
%76 = load float*, float** %20
%77 = load i32, i32* %21
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds float, float* %76, i64 %78
%80 = load float, float* %79
store float %80, float* %13
br label %81
81: ; preds = %58
%82 = load i32, i32* %21
%83 = add nsw i32 %82, 1
store i32 %83, i32* %21
br label %54
84: ; preds = %54
%85 = load float*, float** %20
store float* %85, float** %8
br label %86
86: ; preds = %84, %45, %38
%87 = load float*, float** %8
ret float* %87
}

LLVM IR (-O2):
@.str = [54 x i8] c"Minimum bounds too small (cannot be inferior to %.4g)\00"
@.str.1 = [52 x i8] c"Maximum bounds too big (cannot be superior to %.4g)\00"
define float* @lookuptable_inv_incfunc(float %0, float %1, i32 %2, float %3, float %4, float %5, float (float)* %6) {
%8 = fsub float %1, %0
%9 = add nsw i32 %2, -1
%10 = sitofp i32 %9 to float
%11 = fdiv float %8, %10
%12 = tail call float %6(float %4)
%13 = tail call float %6(float %5)
%14 = fcmp ogt float %12, %0
br i1 %14, label %15, label %17
15: ; preds = %7
%16 = tail call i32 @sarerror_msg(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), float %12)
br label %38
17: ; preds = %7
%18 = fcmp olt float %13, %1
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i32 @sarerror_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), float %13)
br label %38
21: ; preds = %17
%22 = shl i32 %2, 2
%23 = tail call float* @malloc(i32 %22)
%24 = icmp sgt i32 %2, 0
br i1 %24, label %25, label %38
25: ; preds = %21
%26 = zext i32 %2 to i64
br label %27
27: ; preds = %25, %27
%28 = phi i64 [ 0, %25 ], [ %36, %27 ]
%29 = phi float [ %4, %25 ], [ %34, %27 ]
%30 = trunc i64 %28 to i32
%31 = sitofp i32 %30 to float
%32 = fmul float %11, %31
%33 = tail call float @llvm.fmuladd.f32(float %32, float %1, float %0)
%34 = tail call float @dichotomy_inv_incfunc(float %29, float %5, float %33, float %3, float (float)* %6)
%35 = getelementptr inbounds float, float* %23, i64 %28
store float %34, float* %35
%36 = add nuw nsw i64 %28, 1
%37 = icmp eq i64 %36, %26
br i1 %37, label %38, label %27
38: ; preds = %27, %21, %19, %15
%39 = phi float* [ null, %15 ], [ null, %19 ], [ %23, %21 ], [ %23, %27 ]
ret float* %39
}