#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*/ error_normalize(int, char *);
void normalize(double *phi, unsigned long nvox, double factor) {
  unsigned i;
  char *program = "lib_vwk";
  if (factor == 0.0) {
    error_normalize(17130, program);
  }
  for (i = 0; i < nvox; i++)
    *(phi + i) /= factor;
}


x86 assembly (clang, -O0):
<normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
lea    0xed4(%rip),%rax
mov    %rax,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1156 <normalize+0x46>
jp     1156 <normalize+0x46>
mov    -0x28(%rbp),%rsi
mov    $0x42ea,%edi
call   1030 <error_normalize@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%rax
jae    1192 <normalize+0x82>
movsd  -0x18(%rbp),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115d <normalize+0x4d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1141 <normalize+0x31>
jp     1141 <normalize+0x31>
lea    0xed3(%rip),%rsi
mov    $0x42ea,%edi
movsd  %xmm0,(%rsp)
call   1030 <error_normalize@plt>
movsd  (%rsp),%xmm0
test   %r14,%r14
je     1166 <normalize+0x56>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rax,8),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rax,8)
add    $0x1,%eax
cmp    %r14,%rax
jb     1150 <normalize+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"lib_vwk\00"
define void @normalize(double* %0, i64 %1, double %2) {
%4 = alloca double*
%5 = alloca i64
%6 = alloca double
%7 = alloca i32
%8 = alloca i8*
store double* %0, double** %4
store i64 %1, i64* %5
store double %2, double* %6
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %8
%9 = load double, double* %6
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load i8*, i8** %8
%13 = call i32 @error_normalize(i32 17130, i8* %12)
br label %14
14: ; preds = %11, %3
store i32 0, i32* %7
br label %15
15: ; preds = %28, %14
%16 = load i32, i32* %7
%17 = zext i32 %16 to i64
%18 = load i64, i64* %5
%19 = icmp ult i64 %17, %18
br i1 %19, label %20, label %31
20: ; preds = %15
%21 = load double, double* %6
%22 = load double*, double** %4
%23 = load i32, i32* %7
%24 = zext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = fdiv double %26, %21
store double %27, double* %25
br label %28
28: ; preds = %20
%29 = load i32, i32* %7
%30 = add i32 %29, 1
store i32 %30, i32* %7
br label %15
31: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"lib_vwk\00"
define void @normalize(double* nocapture %0, i64 %1, double %2) {
%4 = fcmp oeq double %2, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @error_normalize(i32 17130, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
%8 = icmp eq i64 %1, 0
br i1 %8, label %17, label %9
9: ; preds = %7, %9
%10 = phi i64 [ %15, %9 ], [ 0, %7 ]
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = fdiv double %12, %2
store double %13, double* %11
%14 = add nuw nsw i64 %10, 1
%15 = and i64 %14, 4294967295
%16 = icmp ult i64 %15, %1
br i1 %16, label %9, label %17
17: ; preds = %9, %7
ret void
}