#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 */
struct pumas_physics {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ compute_cel_grammage_integral(struct pumas_physics *, int,
                                                 int);
int /*<<< orphan*/ compute_kinetic_integral(struct pumas_physics *,
                                            int /*<<< orphan*/,
                                            int /*<<< orphan*/);
int /*<<< orphan*/ compute_pchip_coeffs(struct pumas_physics *, int);
int /*<<< orphan*/ compute_pchip_integral_coeffs(struct pumas_physics *, int);
int /*<<< orphan*/ compute_time_integrals(struct pumas_physics *, int);
int /*<<< orphan*/ table_get_NI_in(struct pumas_physics *, int,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ table_get_NI_in_dK(struct pumas_physics *, int,
                                      int /*<<< orphan*/);
void compute_cel_integrals(struct pumas_physics *physics, int material) {
  compute_pchip_coeffs(physics, material);
  compute_cel_grammage_integral(physics, 0, material);
  compute_cel_grammage_integral(physics, 1, material);
  compute_time_integrals(physics, material);
  compute_kinetic_integral(physics, table_get_NI_in(physics, material, 0),
                           table_get_NI_in_dK(physics, material, 0));
  compute_pchip_integral_coeffs(physics, material);
}


x86 assembly (clang, -O0):
<compute_cel_integrals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1090 <compute_pchip_coeffs@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1080 <compute_cel_grammage_integral@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x1,%esi
call   1080 <compute_cel_grammage_integral@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <compute_time_integrals@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1040 <table_get_NI_in@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1070 <table_get_NI_in_dK@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    %eax,%edx
call   1050 <compute_kinetic_integral@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <compute_pchip_integral_coeffs@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_cel_integrals>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
call   1090 <compute_pchip_coeffs@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1080 <compute_cel_grammage_integral@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
call   1080 <compute_cel_grammage_integral@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <compute_time_integrals@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %edx,%edx
call   1040 <table_get_NI_in@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %edx,%edx
call   1070 <table_get_NI_in_dK@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %eax,%edx
call   1050 <compute_kinetic_integral@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <compute_pchip_integral_coeffs@plt>

LLVM IR (-O0):
%struct.pumas_physics = type { i32 }
define void @compute_cel_integrals(%struct.pumas_physics* %0, i32 %1) {
%3 = alloca %struct.pumas_physics*
%4 = alloca i32
store %struct.pumas_physics* %0, %struct.pumas_physics** %3
store i32 %1, i32* %4
%5 = load %struct.pumas_physics*, %struct.pumas_physics** %3
%6 = load i32, i32* %4
%7 = call i32 @compute_pchip_coeffs(%struct.pumas_physics* %5, i32 %6)
%8 = load %struct.pumas_physics*, %struct.pumas_physics** %3
%9 = load i32, i32* %4
%10 = call i32 @compute_cel_grammage_integral(%struct.pumas_physics* %8, i32 0, i32 %9)
%11 = load %struct.pumas_physics*, %struct.pumas_physics** %3
%12 = load i32, i32* %4
%13 = call i32 @compute_cel_grammage_integral(%struct.pumas_physics* %11, i32 1, i32 %12)
%14 = load %struct.pumas_physics*, %struct.pumas_physics** %3
%15 = load i32, i32* %4
%16 = call i32 @compute_time_integrals(%struct.pumas_physics* %14, i32 %15)
%17 = load %struct.pumas_physics*, %struct.pumas_physics** %3
%18 = load %struct.pumas_physics*, %struct.pumas_physics** %3
%19 = load i32, i32* %4
%20 = call i32 @table_get_NI_in(%struct.pumas_physics* %18, i32 %19, i32 0)
%21 = load %struct.pumas_physics*, %struct.pumas_physics** %3
%22 = load i32, i32* %4
%23 = call i32 @table_get_NI_in_dK(%struct.pumas_physics* %21, i32 %22, i32 0)
%24 = call i32 @compute_kinetic_integral(%struct.pumas_physics* %17, i32 %20, i32 %23)
%25 = load %struct.pumas_physics*, %struct.pumas_physics** %3
%26 = load i32, i32* %4
%27 = call i32 @compute_pchip_integral_coeffs(%struct.pumas_physics* %25, i32 %26)
ret void
}

LLVM IR (-O2):
%struct.pumas_physics = type { i32 }
define void @compute_cel_integrals(%struct.pumas_physics* %0, i32 %1) {
%3 = tail call i32 @compute_pchip_coeffs(%struct.pumas_physics* %0, i32 %1)
%4 = tail call i32 @compute_cel_grammage_integral(%struct.pumas_physics* %0, i32 0, i32 %1)
%5 = tail call i32 @compute_cel_grammage_integral(%struct.pumas_physics* %0, i32 1, i32 %1)
%6 = tail call i32 @compute_time_integrals(%struct.pumas_physics* %0, i32 %1)
%7 = tail call i32 @table_get_NI_in(%struct.pumas_physics* %0, i32 %1, i32 0)
%8 = tail call i32 @table_get_NI_in_dK(%struct.pumas_physics* %0, i32 %1, i32 0)
%9 = tail call i32 @compute_kinetic_integral(%struct.pumas_physics* %0, i32 %7, i32 %8)
%10 = tail call i32 @compute_pchip_integral_coeffs(%struct.pumas_physics* %0, i32 %1)
ret void
}