#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*/ dipole_resistance(double, double, double *, double *);
int /*<<< orphan*/ printf(char *, double, ...);
int main() {
  double l_lambda, l_a, r11, x11;
  l_a = 10000;
  printf("# Dipole resistance for length/diameter = %g\n\n", l_a);
  for (l_lambda = 0.05; l_lambda <= 2; l_lambda += 0.005) {
    dipole_resistance(l_lambda, l_a, &r11, &x11);
    printf("%-16.3f%-16.2f%.2f\n", l_lambda, r11, x11);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xed8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xea9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeac(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11ba <main+0x9a>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <dipole_resistance@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
lea    0xeb3(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  0xe6d(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    115c <main+0x3c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xef0(%rip),%rdi
movsd  0xec8(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xec1(%rip),%xmm0
lea    0x18(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0xef7(%rip),%rbx
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  0xe8c(%rip),%xmm1
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <dipole_resistance@plt>
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x3,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe67(%rip),%xmm0
movsd  0xe67(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1160 <main+0x40>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [47 x i8] c"# Dipole resistance for length/diameter = %g\0A\0A\00"
@.str.1 = [20 x i8] c"%-16.3f%-16.2f%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store double 1.000000e+04, double* %3
%6 = load double, double* %3
%7 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), double %6)
store double 5.000000e-02, double* %2
br label %8
8: ; preds = %19, %0
%9 = load double, double* %2
%10 = fcmp ole double %9, 2.000000e+00
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load double, double* %2
%13 = load double, double* %3
%14 = call i32 @dipole_resistance(double %12, double %13, double* %4, double* %5)
%15 = load double, double* %2
%16 = load double, double* %4
%17 = load double, double* %5
%18 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %15, double %16, double %17)
br label %19
19: ; preds = %11
%20 = load double, double* %2
%21 = fadd double %20, 5.000000e-03
store double %21, double* %2
br label %8
22: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"# Dipole resistance for length/diameter = %g\0A\0A\00"
@.str.1 = [20 x i8] c"%-16.3f%-16.2f%.2f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), double 1.000000e+04)
br label %6
6: ; preds = %0, %6
%7 = phi double [ 5.000000e-02, %0 ], [ %12, %6 ]
%8 = call i32 @dipole_resistance(double %7, double 1.000000e+04, double* %1, double* %2)
%9 = load double, double* %1
%10 = load double, double* %2
%11 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %7, double %9, double %10)
%12 = fadd double %7, 5.000000e-03
%13 = fcmp ugt double %12, 2.000000e+00
br i1 %13, label %14, label %6
14: ; preds = %6
ret i32 0
}