#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 pow(double, int);
double logspace(double start, double stop, int N, int i) {
  if (start == stop)
    return start;
  return start * pow(pow(stop / start, 1. / (N - 1)), i);
}


x86 assembly (clang, -O0):
<logspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    114d <logspace+0x3d>
jp     114d <logspace+0x3d>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1199 <logspace+0x89>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm2
movsd  0xe8d(%rip),%xmm1
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <pow@plt>
mov    -0x20(%rbp),%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logspace>:
ucomisd %xmm1,%xmm0
jne    1119 <logspace+0x9>
jp     1119 <logspace+0x9>
ret
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
divsd  %xmm0,%xmm1
add    $0xffffffff,%edi
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movsd  0xec4(%rip),%xmm2
divsd  %xmm0,%xmm2
cvttsd2si %xmm2,%edi
movapd %xmm1,%xmm0
call   1030 <pow@plt>
mov    %ebx,%edi
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @logspace(double %0, double %1, i32 %2, i32 %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
store double %0, double* %6
store double %1, double* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load double, double* %6
%11 = load double, double* %7
%12 = fcmp oeq double %10, %11
br i1 %12, label %13, label %15
13: ; preds = %4
%14 = load double, double* %6
store double %14, double* %5
br label %29
15: ; preds = %4
%16 = load double, double* %6
%17 = load double, double* %7
%18 = load double, double* %6
%19 = fdiv double %17, %18
%20 = load i32, i32* %8
%21 = sub nsw i32 %20, 1
%22 = sitofp i32 %21 to double
%23 = fdiv double 1.000000e+00, %22
%24 = fptosi double %23 to i32
%25 = call double @pow(double %19, i32 %24)
%26 = load i32, i32* %9
%27 = call double @pow(double %25, i32 %26)
%28 = fmul double %16, %27
store double %28, double* %5
br label %29
29: ; preds = %15, %13
%30 = load double, double* %5
ret double %30
}

LLVM IR (-O2):
define double @logspace(double %0, double %1, i32 %2, i32 %3) {
%5 = fcmp oeq double %0, %1
br i1 %5, label %15, label %6
6: ; preds = %4
%7 = fdiv double %1, %0
%8 = add nsw i32 %2, -1
%9 = sitofp i32 %8 to double
%10 = fdiv double 1.000000e+00, %9
%11 = fptosi double %10 to i32
%12 = tail call double @pow(double %7, i32 %11)
%13 = tail call double @pow(double %12, i32 %3)
%14 = fmul double %13, %0
br label %15
15: ; preds = %4, %6
%16 = phi double [ %14, %6 ], [ %0, %4 ]
ret double %16
}