#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 parList {
  int dummy;
};
struct grid {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_fluxes(struct grid *, double, struct parList *);
int /*<<< orphan*/ add_sources(struct grid *, double, struct parList *);
int /*<<< orphan*/ bc_1L(struct grid *, struct parList *);
int /*<<< orphan*/ bc_1R(struct grid *, struct parList *);
int /*<<< orphan*/ bc_2L(struct grid *, struct parList *);
int /*<<< orphan*/ bc_2R(struct grid *, struct parList *);
int /*<<< orphan*/ calc_cons(struct grid *, struct parList *);
int /*<<< orphan*/ calc_grad(struct grid *, struct parList *);
int /*<<< orphan*/ calc_prim(struct grid *, struct parList *);
void substep(struct grid *g, double rkfac1, double rkfac2, double dt,
             struct parList *pars) {
  calc_grad(g, pars);
  add_fluxes(g, dt, pars);
  add_sources(g, dt, pars);
  calc_prim(g, pars);
  bc_1L(g, pars);
  bc_1R(g, pars);
  bc_2L(g, pars);
  bc_2R(g, pars);
  calc_cons(g, pars);
}


x86 assembly (clang, -O0):
<substep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10b0 <calc_grad@plt>
mov    -0x8(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rsi
call   1050 <add_fluxes@plt>
mov    -0x8(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rsi
call   10a0 <add_sources@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1090 <calc_prim@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <bc_1L@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <bc_1R@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <bc_2L@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <bc_2R@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1080 <calc_cons@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<substep>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
movsd  %xmm2,(%rsp)
mov    %rdi,%rbx
call   10b0 <calc_grad@plt>
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
mov    %r14,%rsi
call   1050 <add_fluxes@plt>
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
mov    %r14,%rsi
call   10a0 <add_sources@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <calc_prim@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <bc_1L@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <bc_1R@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <bc_2L@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <bc_2R@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1080 <calc_cons@plt>

LLVM IR (-O0):
%struct.grid = type { i32 }
%struct.parList = type { i32 }
define void @substep(%struct.grid* %0, double %1, double %2, double %3, %struct.parList* %4) {
%6 = alloca %struct.grid*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca %struct.parList*
store %struct.grid* %0, %struct.grid** %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store %struct.parList* %4, %struct.parList** %10
%11 = load %struct.grid*, %struct.grid** %6
%12 = load %struct.parList*, %struct.parList** %10
%13 = call i32 @calc_grad(%struct.grid* %11, %struct.parList* %12)
%14 = load %struct.grid*, %struct.grid** %6
%15 = load double, double* %9
%16 = load %struct.parList*, %struct.parList** %10
%17 = call i32 @add_fluxes(%struct.grid* %14, double %15, %struct.parList* %16)
%18 = load %struct.grid*, %struct.grid** %6
%19 = load double, double* %9
%20 = load %struct.parList*, %struct.parList** %10
%21 = call i32 @add_sources(%struct.grid* %18, double %19, %struct.parList* %20)
%22 = load %struct.grid*, %struct.grid** %6
%23 = load %struct.parList*, %struct.parList** %10
%24 = call i32 @calc_prim(%struct.grid* %22, %struct.parList* %23)
%25 = load %struct.grid*, %struct.grid** %6
%26 = load %struct.parList*, %struct.parList** %10
%27 = call i32 @bc_1L(%struct.grid* %25, %struct.parList* %26)
%28 = load %struct.grid*, %struct.grid** %6
%29 = load %struct.parList*, %struct.parList** %10
%30 = call i32 @bc_1R(%struct.grid* %28, %struct.parList* %29)
%31 = load %struct.grid*, %struct.grid** %6
%32 = load %struct.parList*, %struct.parList** %10
%33 = call i32 @bc_2L(%struct.grid* %31, %struct.parList* %32)
%34 = load %struct.grid*, %struct.grid** %6
%35 = load %struct.parList*, %struct.parList** %10
%36 = call i32 @bc_2R(%struct.grid* %34, %struct.parList* %35)
%37 = load %struct.grid*, %struct.grid** %6
%38 = load %struct.parList*, %struct.parList** %10
%39 = call i32 @calc_cons(%struct.grid* %37, %struct.parList* %38)
ret void
}

LLVM IR (-O2):
%struct.grid = type { i32 }
%struct.parList = type { i32 }
define void @substep(%struct.grid* %0, double %1, double %2, double %3, %struct.parList* %4) {
%6 = tail call i32 @calc_grad(%struct.grid* %0, %struct.parList* %4)
%7 = tail call i32 @add_fluxes(%struct.grid* %0, double %3, %struct.parList* %4)
%8 = tail call i32 @add_sources(%struct.grid* %0, double %3, %struct.parList* %4)
%9 = tail call i32 @calc_prim(%struct.grid* %0, %struct.parList* %4)
%10 = tail call i32 @bc_1L(%struct.grid* %0, %struct.parList* %4)
%11 = tail call i32 @bc_1R(%struct.grid* %0, %struct.parList* %4)
%12 = tail call i32 @bc_2L(%struct.grid* %0, %struct.parList* %4)
%13 = tail call i32 @bc_2R(%struct.grid* %0, %struct.parList* %4)
%14 = tail call i32 @calc_cons(%struct.grid* %0, %struct.parList* %4)
ret void
}