#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 */
double cell_volume(double **);
double pow(double, double);
int /*<<< orphan*/ real_prod(double *, double);
void scale_cell(double c[3][3], double s) {
  if (s < 0)
    s = pow(-s / cell_volume(c), 1.0 / 3);
  for (int i = 0; i < 3; ++i) {
    real_prod(c[i], s);
  }
}


x86 assembly (clang, -O0):
<scale_cell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1197 <scale_cell+0x67>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <cell_volume@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe73(%rip),%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11cf <scale_cell+0x9f>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rax
imul   $0x18,%rax,%rax
add    %rax,%rdi
movsd  -0x10(%rbp),%xmm0
call   1040 <real_prod@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119e <scale_cell+0x6e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_cell>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    1171 <scale_cell+0x41>
xorpd  0xeb6(%rip),%xmm0
movapd %xmm0,(%rsp)
mov    %rbx,%rdi
call   1030 <cell_volume@plt>
movapd (%rsp),%xmm2
divsd  %xmm0,%xmm2
movsd  0xea8(%rip),%xmm1
movapd %xmm2,%xmm0
call   1050 <pow@plt>
movapd %xmm0,(%rsp)
mov    %rbx,%rdi
call   1040 <real_prod@plt>
lea    0x18(%rbx),%rdi
movaps (%rsp),%xmm0
call   1040 <real_prod@plt>
add    $0x30,%rbx
mov    %rbx,%rdi
movaps (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
jmp    1040 <real_prod@plt>

LLVM IR (-O0):
define void @scale_cell([3 x double]* %0, double %1) {
%3 = alloca [3 x double]*
%4 = alloca double
%5 = alloca i32
store [3 x double]* %0, [3 x double]** %3
store double %1, double* %4
%6 = load double, double* %4
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load double, double* %4
%10 = fneg double %9
%11 = load [3 x double]*, [3 x double]** %3
%12 = bitcast [3 x double]* %11 to double**
%13 = call double @cell_volume(double** %12)
%14 = fdiv double %10, %13
%15 = call double @pow(double %14, double 0x3FD5555555555555)
store double %15, double* %4
br label %16
16: ; preds = %8, %2
store i32 0, i32* %5
br label %17
17: ; preds = %28, %16
%18 = load i32, i32* %5
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %31
20: ; preds = %17
%21 = load [3 x double]*, [3 x double]** %3
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 %23
%25 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 0
%26 = load double, double* %4
%27 = call i32 @real_prod(double* %25, double %26)
br label %28
28: ; preds = %20
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %17
31: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @scale_cell([3 x double]* %0, double %1) {
%3 = fcmp olt double %1, 0.000000e+00
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = fneg double %1
%6 = bitcast [3 x double]* %0 to double**
%7 = tail call double @cell_volume(double** %6)
%8 = fdiv double %5, %7
%9 = tail call double @pow(double %8, double 0x3FD5555555555555)
br label %10
10: ; preds = %4, %2
%11 = phi double [ %9, %4 ], [ %1, %2 ]
%12 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%13 = tail call i32 @real_prod(double* %12, double %11)
%14 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%15 = tail call i32 @real_prod(double* %14, double %11)
%16 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%17 = tail call i32 @real_prod(double* %16, double %11)
ret void
}