int logspec(dummy, nloge, sloge, sspec, loge, spec, stat)
double dummy;
int nloge, sloge, sspec;
const double loge[];
double spec[];
int stat[];
{
  register int iloge, *statp;
  register const double *logep;
  register double *specp;
  logep = loge;
  specp = spec;
  statp = stat;
  for (iloge = 0; iloge < nloge; iloge++) {
    *specp = exp(*logep);
    *(statp++) = 0;
    logep += sloge;
    specp += sspec;
  }
  return 0;
}


x86 assembly (clang, -O0):
<logspec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bf <logspec+0xaf>
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <exp@plt>
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x40(%rbp)
movl   $0x0,(%rax)
mov    -0x10(%rbp),%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1151 <logspec+0x41>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logspec>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1166 <logspec+0x56>
mov    %r9,%r12
mov    %r8,%r15
mov    %rcx,%rbx
movslq %esi,%r13
movslq %edx,%rax
shl    $0x3,%rax
mov    %rax,(%rsp)
shl    $0x3,%r13
mov    %edi,%ebp
xor    %r14d,%r14d
nop
movsd  (%rbx),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,(%r15)
movl   $0x0,(%r12,%r14,4)
add    (%rsp),%r15
add    %r13,%rbx
add    $0x1,%r14
cmp    %r14d,%ebp
jne    1140 <logspec+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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