#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*/ xyz2cyl(double, double, double, double *, double *,
                           double *);
void apply(int n, double *rr, double *r, double *phi, double *z) {
  enum { X, Y, Z };
  int i;
  for (i = 0; i < n; i++) {
    xyz2cyl(rr[X], rr[Y], rr[Z], r, phi, z);
    rr += 3;
    r++;
    phi++;
    z++;
  }
}


x86 assembly (clang, -O0):
<apply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a7 <apply+0x97>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <xyz2cyl@plt>
mov    -0x10(%rbp),%rax
add    $0x18,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1132 <apply+0x22>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apply>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    1161 <apply+0x51>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %edi,%ebp
nopw   0x0(%rax,%rax,1)
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
movsd  0x10(%rbx),%xmm2
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <xyz2cyl@plt>
add    $0x8,%r12
add    $0x8,%r15
add    $0x8,%r14
add    $0x18,%rbx
add    $0xffffffff,%ebp
jne    1130 <apply+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @apply(i32 %0, double* %1, double* %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
store i32 %0, i32* %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
store i32 0, i32* %11
br label %12
12: ; preds = %38, %5
%13 = load i32, i32* %11
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %41
16: ; preds = %12
%17 = load double*, double** %7
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
%20 = load double*, double** %7
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
%23 = load double*, double** %7
%24 = getelementptr inbounds double, double* %23, i64 2
%25 = load double, double* %24
%26 = load double*, double** %8
%27 = load double*, double** %9
%28 = load double*, double** %10
%29 = call i32 @xyz2cyl(double %19, double %22, double %25, double* %26, double* %27, double* %28)
%30 = load double*, double** %7
%31 = getelementptr inbounds double, double* %30, i64 3
store double* %31, double** %7
%32 = load double*, double** %8
%33 = getelementptr inbounds double, double* %32, i32 1
store double* %33, double** %8
%34 = load double*, double** %9
%35 = getelementptr inbounds double, double* %34, i32 1
store double* %35, double** %9
%36 = load double*, double** %10
%37 = getelementptr inbounds double, double* %36, i32 1
store double* %37, double** %10
br label %38
38: ; preds = %16
%39 = load i32, i32* %11
%40 = add nsw i32 %39, 1
store i32 %40, i32* %11
br label %12
41: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @apply(i32 %0, double* nocapture %1, double* %2, double* %3, double* %4) {
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %25
7: ; preds = %5, %7
%8 = phi i32 [ %23, %7 ], [ 0, %5 ]
%9 = phi double* [ %22, %7 ], [ %4, %5 ]
%10 = phi double* [ %21, %7 ], [ %3, %5 ]
%11 = phi double* [ %20, %7 ], [ %2, %5 ]
%12 = phi double* [ %19, %7 ], [ %1, %5 ]
%13 = load double, double* %12
%14 = getelementptr inbounds double, double* %12, i64 1
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %12, i64 2
%17 = load double, double* %16
%18 = tail call i32 @xyz2cyl(double %13, double %15, double %17, double* %11, double* %10, double* %9)
%19 = getelementptr inbounds double, double* %12, i64 3
%20 = getelementptr inbounds double, double* %11, i64 1
%21 = getelementptr inbounds double, double* %10, i64 1
%22 = getelementptr inbounds double, double* %9, i64 1
%23 = add nuw nsw i32 %8, 1
%24 = icmp eq i32 %23, %0
br i1 %24, label %25, label %7
25: ; preds = %7, %5
ret void
}