#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 particleline {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_particle(struct particleline *, double, double, double);
void add_cell_particles(struct particleline *Partline, double i, double j,
                        double k, double dx, double dy, double dz, int ppc) {
  int ic, jc, kc;
  double x, y, z;
  for (ic = 1; ic <= ppc; ic++) {
    x = (i - 1) * dx + (ic - 0.5) / ((double)ppc) * dx;
    for (jc = 1; jc <= ppc; jc++) {
      y = (j - 1) * dy + (jc - 0.5) / ((double)ppc) * dy;
      for (kc = 1; kc <= ppc; kc++) {
        z = (k - 1) * dz + (kc - 0.5) / ((double)ppc) * dz;
        add_particle(Partline, x, y, z);
      }
    }
  }
}


x86 assembly (clang, -O0):
<add_cell_particles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
mov    %esi,-0x3c(%rbp)
movl   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     1288 <add_cell_particles+0x178>
movsd  -0x10(%rbp),%xmm0
movsd  0xeab(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm2
cvtsi2sdl -0x40(%rbp),%xmm1
movsd  0xe8d(%rip),%xmm3
subsd  %xmm3,%xmm1
cvtsi2sdl -0x3c(%rbp),%xmm3
divsd  %xmm3,%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     1275 <add_cell_particles+0x165>
movsd  -0x18(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm2
cvtsi2sdl -0x44(%rbp),%xmm1
movsd  0xe38(%rip),%xmm3
subsd  %xmm3,%xmm1
cvtsi2sdl -0x3c(%rbp),%xmm3
divsd  %xmm3,%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     1262 <add_cell_particles+0x152>
movsd  -0x20(%rbp),%xmm0
movsd  0xe01(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm2
cvtsi2sdl -0x48(%rbp),%xmm1
movsd  0xde3(%rip),%xmm3
subsd  %xmm3,%xmm1
cvtsi2sdl -0x3c(%rbp),%xmm3
divsd  %xmm3,%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x50(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
call   1030 <add_particle@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11ee <add_cell_particles+0xde>
jmp    1267 <add_cell_particles+0x157>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1199 <add_cell_particles+0x89>
jmp    127a <add_cell_particles+0x16a>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1144 <add_cell_particles+0x34>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_cell_particles>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movsd  %xmm4,0x8(%rsp)
movsd  %xmm3,(%rsp)
test   %esi,%esi
jle    1278 <add_cell_particles+0x168>
mov    %esi,%r14d
movapd %xmm2,%xmm3
mov    %rdi,%r13
movsd  0xebd(%rip),%xmm2
addsd  %xmm2,%xmm0
xorps  %xmm4,%xmm4
cvtsi2sd %esi,%xmm4
addsd  %xmm2,%xmm1
addsd  %xmm2,%xmm3
mov    %esi,%ebp
neg    %ebp
mov    $0x1,%r15d
movsd  0xea0(%rip),%xmm6
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x18(%rsp)
mulsd  %xmm5,%xmm3
movsd  %xmm5,0x30(%rsp)
movsd  %xmm3,0x28(%rsp)
movsd  %xmm4,0x20(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
addsd  %xmm6,%xmm0
divsd  %xmm4,%xmm0
mulsd  (%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
mov    $0x1,%r12d
movsd  %xmm0,0x38(%rsp)
nopw   0x0(%rax,%rax,1)
xorps  %xmm1,%xmm1
cvtsi2sd %r12d,%xmm1
addsd  %xmm6,%xmm1
divsd  %xmm4,%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  0x18(%rsp),%xmm1
movsd  %xmm1,0x40(%rsp)
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
xorps  %xmm2,%xmm2
cvtsi2sd %ebx,%xmm2
addsd  %xmm6,%xmm2
divsd  %xmm4,%xmm2
mulsd  %xmm5,%xmm2
addsd  %xmm3,%xmm2
mov    %r13,%rdi
movsd  0x38(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
call   1030 <add_particle@plt>
movsd  0xdd5(%rip),%xmm6
movsd  0x20(%rsp),%xmm4
movsd  0x28(%rsp),%xmm3
movsd  0x30(%rsp),%xmm5
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1200 <add_cell_particles+0xf0>
lea    0x1(%r12),%eax
cmp    %r14d,%r12d
mov    %eax,%r12d
jne    11d0 <add_cell_particles+0xc0>
lea    0x1(%r15),%eax
cmp    %r14d,%r15d
mov    %eax,%r15d
jne    11a0 <add_cell_particles+0x90>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.particleline = type { i32 }
define void @add_cell_particles(%struct.particleline* %0, double %1, double %2, double %3, double %4, double %5, double %6, i32 %7) {
%9 = alloca %struct.particleline*
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca double
%21 = alloca double
%22 = alloca double
store %struct.particleline* %0, %struct.particleline** %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double %6, double* %15
store i32 %7, i32* %16
store i32 1, i32* %17
br label %23
23: ; preds = %87, %8
%24 = load i32, i32* %17
%25 = load i32, i32* %16
%26 = icmp sle i32 %24, %25
br i1 %26, label %27, label %90
27: ; preds = %23
%28 = load double, double* %10
%29 = fsub double %28, 1.000000e+00
%30 = load double, double* %13
%31 = load i32, i32* %17
%32 = sitofp i32 %31 to double
%33 = fsub double %32, 5.000000e-01
%34 = load i32, i32* %16
%35 = sitofp i32 %34 to double
%36 = fdiv double %33, %35
%37 = load double, double* %13
%38 = fmul double %36, %37
%39 = call double @llvm.fmuladd.f64(double %29, double %30, double %38)
store double %39, double* %20
store i32 1, i32* %18
br label %40
40: ; preds = %83, %27
%41 = load i32, i32* %18
%42 = load i32, i32* %16
%43 = icmp sle i32 %41, %42
br i1 %43, label %44, label %86
44: ; preds = %40
%45 = load double, double* %11
%46 = fsub double %45, 1.000000e+00
%47 = load double, double* %14
%48 = load i32, i32* %18
%49 = sitofp i32 %48 to double
%50 = fsub double %49, 5.000000e-01
%51 = load i32, i32* %16
%52 = sitofp i32 %51 to double
%53 = fdiv double %50, %52
%54 = load double, double* %14
%55 = fmul double %53, %54
%56 = call double @llvm.fmuladd.f64(double %46, double %47, double %55)
store double %56, double* %21
store i32 1, i32* %19
br label %57
57: ; preds = %79, %44
%58 = load i32, i32* %19
%59 = load i32, i32* %16
%60 = icmp sle i32 %58, %59
br i1 %60, label %61, label %82
61: ; preds = %57
%62 = load double, double* %12
%63 = fsub double %62, 1.000000e+00
%64 = load double, double* %15
%65 = load i32, i32* %19
%66 = sitofp i32 %65 to double
%67 = fsub double %66, 5.000000e-01
%68 = load i32, i32* %16
%69 = sitofp i32 %68 to double
%70 = fdiv double %67, %69
%71 = load double, double* %15
%72 = fmul double %70, %71
%73 = call double @llvm.fmuladd.f64(double %63, double %64, double %72)
store double %73, double* %22
%74 = load %struct.particleline*, %struct.particleline** %9
%75 = load double, double* %20
%76 = load double, double* %21
%77 = load double, double* %22
%78 = call i32 @add_particle(%struct.particleline* %74, double %75, double %76, double %77)
br label %79
79: ; preds = %61
%80 = load i32, i32* %19
%81 = add nsw i32 %80, 1
store i32 %81, i32* %19
br label %57
82: ; preds = %57
br label %83
83: ; preds = %82
%84 = load i32, i32* %18
%85 = add nsw i32 %84, 1
store i32 %85, i32* %18
br label %40
86: ; preds = %40
br label %87
87: ; preds = %86
%88 = load i32, i32* %17
%89 = add nsw i32 %88, 1
store i32 %89, i32* %17
br label %23
90: ; preds = %23
ret void
}

LLVM IR (-O2):
%struct.particleline = type { i32 }
define void @add_cell_particles(%struct.particleline* %0, double %1, double %2, double %3, double %4, double %5, double %6, i32 %7) {
%9 = icmp slt i32 %7, 1
br i1 %9, label %45, label %10
10: ; preds = %8
%11 = fadd double %1, -1.000000e+00
%12 = sitofp i32 %7 to double
%13 = fadd double %2, -1.000000e+00
%14 = fadd double %3, -1.000000e+00
br label %15
15: ; preds = %42, %10
%16 = phi i32 [ 1, %10 ], [ %43, %42 ]
%17 = sitofp i32 %16 to double
%18 = fadd double %17, -5.000000e-01
%19 = fdiv double %18, %12
%20 = fmul double %19, %4
%21 = tail call double @llvm.fmuladd.f64(double %11, double %4, double %20)
br label %22
22: ; preds = %39, %15
%23 = phi i32 [ %40, %39 ], [ 1, %15 ]
%24 = sitofp i32 %23 to double
%25 = fadd double %24, -5.000000e-01
%26 = fdiv double %25, %12
%27 = fmul double %26, %5
%28 = tail call double @llvm.fmuladd.f64(double %13, double %5, double %27)
br label %29
29: ; preds = %22, %29
%30 = phi i32 [ %37, %29 ], [ 1, %22 ]
%31 = sitofp i32 %30 to double
%32 = fadd double %31, -5.000000e-01
%33 = fdiv double %32, %12
%34 = fmul double %33, %6
%35 = tail call double @llvm.fmuladd.f64(double %14, double %6, double %34)
%36 = tail call i32 @add_particle(%struct.particleline* %0, double %21, double %28, double %35)
%37 = add nuw i32 %30, 1
%38 = icmp eq i32 %30, %7
br i1 %38, label %39, label %29
39: ; preds = %29
%40 = add nuw i32 %23, 1
%41 = icmp eq i32 %23, %7
br i1 %41, label %42, label %22
42: ; preds = %39
%43 = add nuw i32 %16, 1
%44 = icmp eq i32 %16, %7
br i1 %44, label %45, label %15
45: ; preds = %42, %8
ret void
}