#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ calc_d(float, float, float, float, float, float, double,
                          double, float *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *);
int sscanf(char *, char *, float *, float *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int i;
  int readok = 0;
  int contin = 1;
  float zl;
  float zs;
  float dzl = 0.0;
  float dzs = 0.0;
  float d;
  double omega0 = 0.3;
  double lambda = 0.7;
  float theta;
  float dtheta;
  char line[80];
  FILE *ofp = NULL;
  readok = 0;
  printf("Enter lens redshift and optional error on redshift:  ");
  while (readok == 0) {
    fgets(line, 80, stdin);
    switch (sscanf(line, "%f %f", &zl, &dzl)) {
    case 1:
      if (zl < 0.0) {
        fprintf(stderr, "ERROR: improper input.  Enter value(s) again:  ");
        break;
      } else {
        readok = 1;
        break;
      }
    case 2:
      if (zl < 0.0 || dzl < 0.0) {
        fprintf(stderr, "ERROR: improper input.  Enter value(s) again:  ");
        break;
      } else {
        readok = 1;
        break;
      }
    default:
      fprintf(stderr, "ERROR: improper input.  Enter value(s) again:  ");
    }
  }
  readok = 0;
  printf("Enter source redshift and optional error on redshift:  ");
  while (readok == 0) {
    fgets(line, 80, stdin);
    switch (sscanf(line, "%f %f", &zs, &dzs)) {
    case 1:
      if (zs < 0.0) {
        fprintf(stderr, "ERROR: improper input.  Enter value(s) again:  ");
        break;
      } else {
        readok = 1;
        break;
      }
    case 2:
      if (zs < 0.0 || dzs < 0.0) {
        fprintf(stderr, "ERROR: improper input.  Enter value(s) again:  ");
        break;
      } else {
        readok = 1;
        break;
      }
    default:
      fprintf(stderr, "ERROR: improper input.  Enter value(s) again:  ");
    }
  }
  readok = 0;
  printf("Enter max image separation (arcsec) and optional error:  ");
  while (readok == 0) {
    fgets(line, 80, stdin);
    switch (sscanf(line, "%f %f", &theta, &dtheta)) {
    case 1:
      if (theta < 0.0) {
        fprintf(stderr, "ERROR: improper input.  Enter value(s) again:  ");
        break;
      } else {
        readok = 1;
        break;
      }
    case 2:
      if (theta < 0.0 || dtheta < 0.0) {
        fprintf(stderr, "ERROR: improper input.  Enter value(s) again:  ");
        break;
      } else {
        readok = 1;
        break;
      }
    default:
      fprintf(stderr, "ERROR: improper input.  Enter value(s) again:  ");
    }
  }
  if ((ofp = fopen("d.out", "w")) == NULL) {
    fprintf(stderr, "ERROR: Cannot open d.out.\n");
    return 1;
  }
  printf("d.out is now open\n");
  for (i = 0; i < 101; i++) {
    omega0 = i / 100.0;
    lambda = 1.0 - omega0;
    calc_d(zl, zs, dzl, dzs, theta, dtheta, omega0, lambda, &d);
    fprintf(ofp, "%4.2f %4.2f %f\n", omega0, lambda, d);
  }
  fclose(ofp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movsd  0xe59(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe44(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movq   $0x0,-0xa8(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe46(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1300 <main+0x190>
mov    0x2df8(%rip),%rax
mov    (%rax),%edx
lea    -0xa0(%rbp),%rdi
mov    %rdi,-0xb8(%rbp)
mov    $0x50,%esi
call   1060 <fgets@plt>
mov    -0xb8(%rbp),%rdi
lea    0xe3e(%rip),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1080 <sscanf@plt>
mov    %eax,%ecx
mov    %ecx,-0xac(%rbp)
sub    $0x1,%eax
je     124f <main+0xdf>
jmp    123b <main+0xcb>
mov    -0xac(%rbp),%eax
sub    $0x2,%eax
je     128e <main+0x11e>
jmp    12e3 <main+0x173>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1282 <main+0x112>
mov    0x2d6c(%rip),%rax
movslq (%rax),%rdi
lea    0xde6(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    12fb <main+0x18b>
movl   $0x1,-0x18(%rbp)
jmp    12fb <main+0x18b>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     12ba <main+0x14a>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    12d7 <main+0x167>
mov    0x2d17(%rip),%rax
movslq (%rax),%rdi
lea    0xd91(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    12fb <main+0x18b>
movl   $0x1,-0x18(%rbp)
jmp    12fb <main+0x18b>
mov    0x2cee(%rip),%rax
movslq (%rax),%rdi
lea    0xd68(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    11df <main+0x6f>
movl   $0x0,-0x18(%rbp)
lea    0xd7e(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1434 <main+0x2c4>
mov    0x2cc4(%rip),%rax
mov    (%rax),%edx
lea    -0xa0(%rbp),%rdi
mov    %rdi,-0xc8(%rbp)
mov    $0x50,%esi
call   1060 <fgets@plt>
mov    -0xc8(%rbp),%rdi
lea    0xd0a(%rip),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
call   1080 <sscanf@plt>
mov    %eax,%ecx
mov    %ecx,-0xbc(%rbp)
sub    $0x1,%eax
je     1383 <main+0x213>
jmp    136f <main+0x1ff>
mov    -0xbc(%rbp),%eax
sub    $0x2,%eax
je     13c2 <main+0x252>
jmp    1417 <main+0x2a7>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    13b6 <main+0x246>
mov    0x2c38(%rip),%rax
movslq (%rax),%rdi
lea    0xcb2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    142f <main+0x2bf>
movl   $0x1,-0x18(%rbp)
jmp    142f <main+0x2bf>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     13ee <main+0x27e>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    140b <main+0x29b>
mov    0x2be3(%rip),%rax
movslq (%rax),%rdi
lea    0xc5d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    142f <main+0x2bf>
movl   $0x1,-0x18(%rbp)
jmp    142f <main+0x2bf>
mov    0x2bba(%rip),%rax
movslq (%rax),%rdi
lea    0xc34(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1313 <main+0x1a3>
movl   $0x0,-0x18(%rbp)
lea    0xc82(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1568 <main+0x3f8>
mov    0x2b90(%rip),%rax
mov    (%rax),%edx
lea    -0xa0(%rbp),%rdi
mov    %rdi,-0xd8(%rbp)
mov    $0x50,%esi
call   1060 <fgets@plt>
mov    -0xd8(%rbp),%rdi
lea    0xbd6(%rip),%rsi
lea    -0x44(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1080 <sscanf@plt>
mov    %eax,%ecx
mov    %ecx,-0xcc(%rbp)
sub    $0x1,%eax
je     14b7 <main+0x347>
jmp    14a3 <main+0x333>
mov    -0xcc(%rbp),%eax
sub    $0x2,%eax
je     14f6 <main+0x386>
jmp    154b <main+0x3db>
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    14ea <main+0x37a>
mov    0x2b04(%rip),%rax
movslq (%rax),%rdi
lea    0xb7e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1563 <main+0x3f3>
movl   $0x1,-0x18(%rbp)
jmp    1563 <main+0x3f3>
movss  -0x44(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
ja     1522 <main+0x3b2>
movss  -0x48(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    153f <main+0x3cf>
mov    0x2aaf(%rip),%rax
movslq (%rax),%rdi
lea    0xb29(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1563 <main+0x3f3>
movl   $0x1,-0x18(%rbp)
jmp    1563 <main+0x3f3>
mov    0x2a86(%rip),%rax
movslq (%rax),%rdi
lea    0xb00(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1447 <main+0x2d7>
lea    0xb8f(%rip),%rdi
lea    0xb8e(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xa8(%rbp)
cmp    $0x0,%rax
jne    15b0 <main+0x440>
mov    0x2a45(%rip),%rax
movslq (%rax),%rdi
lea    0xb69(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    166f <main+0x4ff>
lea    0xb6a(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x65,-0x14(%rbp)
jge    165c <main+0x4ec>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xa3e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xa25(%rip),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
movss  -0x28(%rbp),%xmm2
movss  -0x2c(%rbp),%xmm3
movss  -0x44(%rbp),%xmm4
movss  -0x48(%rbp),%xmm5
movsd  -0x38(%rbp),%xmm6
movsd  -0x40(%rbp),%xmm7
lea    -0x30(%rbp),%rdi
call   1030 <calc_d@plt>
mov    -0xa8(%rbp),%rdi
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movss  -0x30(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xaed(%rip),%rsi
mov    $0x3,%al
call   1070 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    15c3 <main+0x453>
mov    -0xa8(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xe5c(%rip),%rdi
call   1060 <printf@plt>
mov    0x2e24(%rip),%r14
lea    0x40(%rsp),%rbx
lea    0x1c(%rsp),%r15
lea    0x14(%rsp),%r12
mov    0x2dfe(%rip),%rbp
lea    0xe6f(%rip),%r13
jmp    1206 <main+0x76>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq 0x0(%rbp),%rcx
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %r13,%rdi
call   10b0 <fwrite@plt>
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
lea    0xe2a(%rip),%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1090 <sscanf@plt>
cmp    $0x2,%eax
je     1250 <main+0xc0>
cmp    $0x1,%eax
jne    11f0 <main+0x60>
xorps  %xmm0,%xmm0
ucomiss 0x1c(%rsp),%xmm0
ja     11f0 <main+0x60>
jmp    1264 <main+0xd4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
ucomiss 0x1c(%rsp),%xmm0
ja     11f0 <main+0x60>
xorps  %xmm0,%xmm0
ucomiss 0x14(%rsp),%xmm0
ja     11f0 <main+0x60>
lea    0xe15(%rip),%rdi
call   1060 <printf@plt>
lea    0x40(%rsp),%rbx
lea    0x18(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xdca(%rip),%r13
jmp    12a6 <main+0x116>
nopl   0x0(%rax,%rax,1)
movslq 0x0(%rbp),%rcx
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %r13,%rdi
call   10b0 <fwrite@plt>
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
lea    0xd8a(%rip),%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1090 <sscanf@plt>
cmp    $0x2,%eax
je     12f0 <main+0x160>
cmp    $0x1,%eax
jne    1290 <main+0x100>
xorps  %xmm0,%xmm0
ucomiss 0x18(%rsp),%xmm0
ja     1290 <main+0x100>
jmp    1304 <main+0x174>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
ucomiss 0x18(%rsp),%xmm0
ja     1290 <main+0x100>
xorps  %xmm0,%xmm0
ucomiss 0x10(%rsp),%xmm0
ja     1290 <main+0x100>
lea    0xdad(%rip),%rdi
call   1060 <printf@plt>
lea    0x40(%rsp),%rbx
lea    0xc(%rsp),%r15
lea    0x20(%rsp),%r12
lea    0xd2a(%rip),%r13
jmp    1346 <main+0x1b6>
nopl   0x0(%rax,%rax,1)
movslq 0x0(%rbp),%rcx
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %r13,%rdi
call   10b0 <fwrite@plt>
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
lea    0xcea(%rip),%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1090 <sscanf@plt>
cmp    $0x2,%eax
je     1390 <main+0x200>
cmp    $0x1,%eax
jne    1330 <main+0x1a0>
xorps  %xmm0,%xmm0
ucomiss 0xc(%rsp),%xmm0
ja     1330 <main+0x1a0>
jmp    13a4 <main+0x214>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
ucomiss 0xc(%rsp),%xmm0
ja     1330 <main+0x1a0>
xorps  %xmm0,%xmm0
ucomiss 0x20(%rsp),%xmm0
ja     1330 <main+0x1a0>
lea    0xd47(%rip),%rdi
lea    0xd46(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1496 <main+0x306>
mov    %rax,%rbx
lea    0xd5b(%rip),%rdi
call   1040 <puts@plt>
xorps  %xmm0,%xmm0
mov    $0x65,%ebp
lea    0x24(%rsp),%r14
lea    0xd32(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm0,0x38(%rsp)
movaps %xmm0,%xmm1
divsd  0xbff(%rip),%xmm1
movsd  0xbff(%rip),%xmm0
subsd  %xmm1,%xmm0
movapd %xmm0,%xmm7
movsd  %xmm0,0x30(%rsp)
movapd %xmm1,%xmm6
movsd  %xmm1,0x28(%rsp)
movss  0x1c(%rsp),%xmm0
movss  0x18(%rsp),%xmm1
movss  0x14(%rsp),%xmm2
movss  0x10(%rsp),%xmm3
movss  0xc(%rsp),%xmm4
movss  0x20(%rsp),%xmm5
mov    %r14,%rdi
call   1030 <calc_d@plt>
movss  0x24(%rsp),%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
mov    %rbx,%rdi
mov    %r15,%rsi
movsd  0x28(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
mov    $0x3,%al
call   1080 <fprintf@plt>
movsd  0x38(%rsp),%xmm0
addsd  0xb87(%rip),%xmm0
add    $0xffffffff,%ebp
jne    13f0 <main+0x260>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    14b5 <main+0x325>
movslq 0x0(%rbp),%rcx
lea    0xc59(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
call   10b0 <fwrite@plt>
mov    $0x1,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Enter lens redshift and optional error on redshift: \00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"%f %f\00"
@stderr = global i32 0
@.str.2 = [48 x i8] c"ERROR: improper input. Enter value(s) again: \00"
@.str.3 = [56 x i8] c"Enter source redshift and optional error on redshift: \00"
@.str.4 = [58 x i8] c"Enter max image separation (arcsec) and optional error: \00"
@.str.5 = [6 x i8] c"d.out\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [27 x i8] c"ERROR: Cannot open d.out.\0A\00"
@.str.8 = [19 x i8] c"d.out is now open\0A\00"
@.str.9 = [16 x i8] c"%4.2f %4.2f %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca double
%15 = alloca double
%16 = alloca float
%17 = alloca float
%18 = alloca [80 x i8]
%19 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 1, i32* %8
store float 0.000000e+00, float* %11
store float 0.000000e+00, float* %12
store double 3.000000e-01, double* %14
store double 0x3FE6666666666666, double* %15
store i32* null, i32** %19
store i32 0, i32* %7
%20 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %59, %2
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %60
24: ; preds = %21
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %18, i64 0, i64 0
%26 = load i32, i32* @stdin
%27 = call i32 @fgets(i8* %25, i32 80, i32 %26)
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %18, i64 0, i64 0
%29 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %9, float* %11)
switch i32 %29, label %54 [
i32 1, label %30
i32 2, label %40
]
30: ; preds = %24
%31 = load float, float* %9
%32 = fpext float %31 to double
%33 = fcmp olt double %32, 0.000000e+00
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = sext i32 %35 to i64
%37 = inttoptr i64 %36 to i32*
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
br label %59
39: ; preds = %30
store i32 1, i32* %7
br label %59
40: ; preds = %24
%41 = load float, float* %9
%42 = fpext float %41 to double
%43 = fcmp olt double %42, 0.000000e+00
br i1 %43, label %48, label %44
44: ; preds = %40
%45 = load float, float* %11
%46 = fpext float %45 to double
%47 = fcmp olt double %46, 0.000000e+00
br i1 %47, label %48, label %53
48: ; preds = %44, %40
%49 = load i32, i32* @stderr
%50 = sext i32 %49 to i64
%51 = inttoptr i64 %50 to i32*
%52 = call i32 (i32*, i8*, ...) @fprintf(i32* %51, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
br label %59
53: ; preds = %44
store i32 1, i32* %7
br label %59
54: ; preds = %24
%55 = load i32, i32* @stderr
%56 = sext i32 %55 to i64
%57 = inttoptr i64 %56 to i32*
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
br label %59
59: ; preds = %54, %53, %48, %39, %34
br label %21
60: ; preds = %21
store i32 0, i32* %7
%61 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
br label %62
62: ; preds = %100, %60
%63 = load i32, i32* %7
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %101
65: ; preds = %62
%66 = getelementptr inbounds [80 x i8], [80 x i8]* %18, i64 0, i64 0
%67 = load i32, i32* @stdin
%68 = call i32 @fgets(i8* %66, i32 80, i32 %67)
%69 = getelementptr inbounds [80 x i8], [80 x i8]* %18, i64 0, i64 0
%70 = call i32 @sscanf(i8* %69, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %10, float* %12)
switch i32 %70, label %95 [
i32 1, label %71
i32 2, label %81
]
71: ; preds = %65
%72 = load float, float* %10
%73 = fpext float %72 to double
%74 = fcmp olt double %73, 0.000000e+00
br i1 %74, label %75, label %80
75: ; preds = %71
%76 = load i32, i32* @stderr
%77 = sext i32 %76 to i64
%78 = inttoptr i64 %77 to i32*
%79 = call i32 (i32*, i8*, ...) @fprintf(i32* %78, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
br label %100
80: ; preds = %71
store i32 1, i32* %7
br label %100
81: ; preds = %65
%82 = load float, float* %10
%83 = fpext float %82 to double
%84 = fcmp olt double %83, 0.000000e+00
br i1 %84, label %89, label %85
85: ; preds = %81
%86 = load float, float* %12
%87 = fpext float %86 to double
%88 = fcmp olt double %87, 0.000000e+00
br i1 %88, label %89, label %94
89: ; preds = %85, %81
%90 = load i32, i32* @stderr
%91 = sext i32 %90 to i64
%92 = inttoptr i64 %91 to i32*
%93 = call i32 (i32*, i8*, ...) @fprintf(i32* %92, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
br label %100
94: ; preds = %85
store i32 1, i32* %7
br label %100
95: ; preds = %65
%96 = load i32, i32* @stderr
%97 = sext i32 %96 to i64
%98 = inttoptr i64 %97 to i32*
%99 = call i32 (i32*, i8*, ...) @fprintf(i32* %98, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
br label %100
100: ; preds = %95, %94, %89, %80, %75
br label %62
101: ; preds = %62
store i32 0, i32* %7
%102 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
br label %103
103: ; preds = %141, %101
%104 = load i32, i32* %7
%105 = icmp eq i32 %104, 0
br i1 %105, label %106, label %142
106: ; preds = %103
%107 = getelementptr inbounds [80 x i8], [80 x i8]* %18, i64 0, i64 0
%108 = load i32, i32* @stdin
%109 = call i32 @fgets(i8* %107, i32 80, i32 %108)
%110 = getelementptr inbounds [80 x i8], [80 x i8]* %18, i64 0, i64 0
%111 = call i32 @sscanf(i8* %110, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %16, float* %17)
switch i32 %111, label %136 [
i32 1, label %112
i32 2, label %122
]
112: ; preds = %106
%113 = load float, float* %16
%114 = fpext float %113 to double
%115 = fcmp olt double %114, 0.000000e+00
br i1 %115, label %116, label %121
116: ; preds = %112
%117 = load i32, i32* @stderr
%118 = sext i32 %117 to i64
%119 = inttoptr i64 %118 to i32*
%120 = call i32 (i32*, i8*, ...) @fprintf(i32* %119, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
br label %141
121: ; preds = %112
store i32 1, i32* %7
br label %141
122: ; preds = %106
%123 = load float, float* %16
%124 = fpext float %123 to double
%125 = fcmp olt double %124, 0.000000e+00
br i1 %125, label %130, label %126
126: ; preds = %122
%127 = load float, float* %17
%128 = fpext float %127 to double
%129 = fcmp olt double %128, 0.000000e+00
br i1 %129, label %130, label %135
130: ; preds = %126, %122
%131 = load i32, i32* @stderr
%132 = sext i32 %131 to i64
%133 = inttoptr i64 %132 to i32*
%134 = call i32 (i32*, i8*, ...) @fprintf(i32* %133, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
br label %141
135: ; preds = %126
store i32 1, i32* %7
br label %141
136: ; preds = %106
%137 = load i32, i32* @stderr
%138 = sext i32 %137 to i64
%139 = inttoptr i64 %138 to i32*
%140 = call i32 (i32*, i8*, ...) @fprintf(i32* %139, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
br label %141
141: ; preds = %136, %135, %130, %121, %116
br label %103
142: ; preds = %103
%143 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %143, i32** %19
%144 = icmp eq i32* %143, null
br i1 %144, label %145, label %150
145: ; preds = %142
%146 = load i32, i32* @stderr
%147 = sext i32 %146 to i64
%148 = inttoptr i64 %147 to i32*
%149 = call i32 (i32*, i8*, ...) @fprintf(i32* %148, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %3
br label %182
150: ; preds = %142
%151 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %6
br label %152
152: ; preds = %176, %150
%153 = load i32, i32* %6
%154 = icmp slt i32 %153, 101
br i1 %154, label %155, label %179
155: ; preds = %152
%156 = load i32, i32* %6
%157 = sitofp i32 %156 to double
%158 = fdiv double %157, 1.000000e+02
store double %158, double* %14
%159 = load double, double* %14
%160 = fsub double 1.000000e+00, %159
store double %160, double* %15
%161 = load float, float* %9
%162 = load float, float* %10
%163 = load float, float* %11
%164 = load float, float* %12
%165 = load float, float* %16
%166 = load float, float* %17
%167 = load double, double* %14
%168 = load double, double* %15
%169 = call i32 @calc_d(float %161, float %162, float %163, float %164, float %165, float %166, double %167, double %168, float* %13)
%170 = load i32*, i32** %19
%171 = load double, double* %14
%172 = load double, double* %15
%173 = load float, float* %13
%174 = fpext float %173 to double
%175 = call i32 (i32*, i8*, ...) @fprintf(i32* %170, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), double %171, double %172, double %174)
br label %176
176: ; preds = %155
%177 = load i32, i32* %6
%178 = add nsw i32 %177, 1
store i32 %178, i32* %6
br label %152
179: ; preds = %152
%180 = load i32*, i32** %19
%181 = call i32 @fclose(i32* %180)
store i32 0, i32* %3
br label %182
182: ; preds = %179, %145
%183 = load i32, i32* %3
ret i32 %183
}

LLVM IR (-O2):
@.str = [54 x i8] c"Enter lens redshift and optional error on redshift: \00"
@stdin = global i32 0
@.str.1 = [6 x i8] c"%f %f\00"
@stderr = global i32 0
@.str.2 = [48 x i8] c"ERROR: improper input. Enter value(s) again: \00"
@.str.3 = [56 x i8] c"Enter source redshift and optional error on redshift: \00"
@.str.4 = [58 x i8] c"Enter max image separation (arcsec) and optional error: \00"
@.str.5 = [6 x i8] c"d.out\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [27 x i8] c"ERROR: Cannot open d.out.\0A\00"
@.str.9 = [16 x i8] c"%4.2f %4.2f %f\0A\00"
@str = [18 x i8] c"d.out is now open\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca [80 x i8]
%11 = bitcast float* %3 to i8*
%12 = bitcast float* %4 to i8*
%13 = bitcast float* %5 to i8*
store float 0.000000e+00, float* %5
%14 = bitcast float* %6 to i8*
store float 0.000000e+00, float* %6
%15 = bitcast float* %7 to i8*
%16 = bitcast float* %8 to i8*
%17 = bitcast float* %9 to i8*
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %33, %2
%21 = load i32, i32* @stdin
%22 = call i32 @fgets(i8* %18, i32 80, i32 %21)
%23 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %3, float* %5)
switch i32 %23, label %33 [
i32 1, label %24
i32 2, label %27
]
24: ; preds = %20
%25 = load float, float* %3
%26 = fcmp olt float %25, 0.000000e+00
br i1 %26, label %33, label %38
27: ; preds = %20
%28 = load float, float* %3
%29 = fcmp olt float %28, 0.000000e+00
%30 = load float, float* %5
%31 = fcmp olt float %30, 0.000000e+00
%32 = select i1 %29, i1 true, i1 %31
br i1 %32, label %33, label %38
33: ; preds = %20, %27, %24
%34 = load i32, i32* @stderr
%35 = sext i32 %34 to i64
%36 = inttoptr i64 %35 to i32*
%37 = call i64 @fwrite(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i64 47, i64 1, i32* %36)
br label %20
38: ; preds = %27, %24
%39 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %53, %38
%41 = load i32, i32* @stdin
%42 = call i32 @fgets(i8* %18, i32 80, i32 %41)
%43 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %4, float* %6)
switch i32 %43, label %53 [
i32 1, label %44
i32 2, label %47
]
44: ; preds = %40
%45 = load float, float* %4
%46 = fcmp olt float %45, 0.000000e+00
br i1 %46, label %53, label %58
47: ; preds = %40
%48 = load float, float* %4
%49 = fcmp olt float %48, 0.000000e+00
%50 = load float, float* %6
%51 = fcmp olt float %50, 0.000000e+00
%52 = select i1 %49, i1 true, i1 %51
br i1 %52, label %53, label %58
53: ; preds = %40, %47, %44
%54 = load i32, i32* @stderr
%55 = sext i32 %54 to i64
%56 = inttoptr i64 %55 to i32*
%57 = call i64 @fwrite(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i64 47, i64 1, i32* %56)
br label %40
58: ; preds = %47, %44
%59 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
br label %60
60: ; preds = %73, %58
%61 = load i32, i32* @stdin
%62 = call i32 @fgets(i8* %18, i32 80, i32 %61)
%63 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %8, float* %9)
switch i32 %63, label %73 [
i32 1, label %64
i32 2, label %67
]
64: ; preds = %60
%65 = load float, float* %8
%66 = fcmp olt float %65, 0.000000e+00
br i1 %66, label %73, label %78
67: ; preds = %60
%68 = load float, float* %8
%69 = fcmp olt float %68, 0.000000e+00
%70 = load float, float* %9
%71 = fcmp olt float %70, 0.000000e+00
%72 = select i1 %69, i1 true, i1 %71
br i1 %72, label %73, label %78
73: ; preds = %60, %67, %64
%74 = load i32, i32* @stderr
%75 = sext i32 %74 to i64
%76 = inttoptr i64 %75 to i32*
%77 = call i64 @fwrite(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i64 47, i64 1, i32* %76)
br label %60
78: ; preds = %67, %64
%79 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%80 = icmp eq i32* %79, null
br i1 %80, label %81, label %86
81: ; preds = %78
%82 = load i32, i32* @stderr
%83 = sext i32 %82 to i64
%84 = inttoptr i64 %83 to i32*
%85 = call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i64 26, i64 1, i32* %84)
br label %107
86: ; preds = %78
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %88
88: ; preds = %86, %88
%89 = phi i32 [ 0, %86 ], [ %103, %88 ]
%90 = sitofp i32 %89 to double
%91 = fdiv double %90, 1.000000e+02
%92 = fsub double 1.000000e+00, %91
%93 = load float, float* %3
%94 = load float, float* %4
%95 = load float, float* %5
%96 = load float, float* %6
%97 = load float, float* %8
%98 = load float, float* %9
%99 = call i32 @calc_d(float %93, float %94, float %95, float %96, float %97, float %98, double %91, double %92, float* %7)
%100 = load float, float* %7
%101 = fpext float %100 to double
%102 = call i32 (i32*, i8*, ...) @fprintf(i32* %79, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), double %91, double %92, double %101)
%103 = add nuw nsw i32 %89, 1
%104 = icmp eq i32 %103, 101
br i1 %104, label %105, label %88
105: ; preds = %88
%106 = call i32 @fclose(i32* %79)
br label %107
107: ; preds = %105, %81
%108 = phi i32 [ 1, %81 ], [ 0, %105 ]
ret i32 %108
}