#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*/ gamess_1d(int, int, int, int);
int /*<<< orphan*/ gamess_get_nmodes_nbas(int *, int *);
int /*<<< orphan*/ harmonic(double, double, double, int);
int /*<<< orphan*/ morse(double, double, double, double, int);
int /*<<< orphan*/ morse_points(double, double, double, double, int);
int /*<<< orphan*/ morse_polynom(double, double, double, double, int);
int /*<<< orphan*/ one_d(char *, double, double, int, int);
int /*<<< orphan*/ one_d_points(char *, double, double, int);
int /*<<< orphan*/ one_d_polynom(char *, double, double, int, int);
int /*<<< orphan*/ parse_1d(char *, int *, int *, double *, double *);
int /*<<< orphan*/ parse_control(char *, int *, int *, int *);
int /*<<< orphan*/ parse_harmonic(char *, double *, int *, double *, double *);
int /*<<< orphan*/ parse_morse(char *, double *, double *, int *, double *,
                               double *);
int /*<<< orphan*/ print_banner();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int task_type = 0;
  int pot_type = 0;
  int friend = 0;
  double xstart = -12.0, xend = 12.0, deltax = 0.2;
  double d = 12.0, w = 0.5;
  int nbas = 128, npow = 16, nmodes = 1;
  print_banner();
  if (argc > 0)
    parse_control(argv[1], &task_type, &pot_type, &friend);
  printf("friend = %2d\n", friend);
  if (friend == 1) {
    printf("in friend\n");
    gamess_get_nmodes_nbas(&nmodes, &nbas);
    gamess_1d(task_type, nmodes, nmodes * (nmodes - 1) / 2, nbas);
  } else {
    switch (task_type) {
    case 0:
      parse_harmonic(argv[1], &w, &nbas, &xstart, &xend);
      break;
    case 1:
      parse_morse(argv[1], &d, &w, &nbas, &xstart, &xend);
      break;
    case 2:
      parse_1d(argv[1], &npow, &nbas, &xstart, &xend);
      break;
    default:
      task_type = 0;
      parse_harmonic(argv[1], &w, &nbas, &xstart, &xend);
      break;
    }
    deltax = (xend - xstart) / ((double)(nbas - 1));
    printf("\n Starting parameters :\n");
    printf(" task   = ");
    switch (task_type) {
    case 0:
      printf("harmonic\n w      = %10g\n", w);
      break;
    case 1:
      printf("morse\n d      = %10g\n w      = %10g\n", d, w);
      break;
    case 2:
      printf("1D\n");
      break;
    }
    printf(" potential   = ");
    switch (pot_type) {
    case 0:
      printf("analytic\n");
      break;
    case 1:
      printf("polynom\n");
      break;
    case 2:
      printf("points\n");
      break;
    }
    printf(" xstart = %10g\n xend   = %10g\n deltax = %10g\n nbas   = %10d\n",
           xstart, xend, deltax, nbas);
    switch (task_type) {
    case 0:
      harmonic(w, xstart, deltax, nbas);
      break;
    case 1:
      switch (pot_type) {
      case 0:
        morse(d, w, xstart, deltax, nbas);
        break;
      case 1:
        morse_polynom(d, w, xstart, deltax, nbas);
        break;
      case 2:
        morse_points(d, w, xstart, deltax, nbas);
        break;
      }
      break;
    case 2:
      switch (pot_type) {
      case 0:
        one_d(argv[1], xstart, deltax, nbas, npow);
        break;
      case 1:
        one_d_polynom(argv[1], xstart, deltax, nbas, npow);
        break;
      case 2:
        one_d_points(argv[1], xstart, deltax, nbas);
        break;
      }
    }
  }
  printf("\n All done!\n\n Arevoir!\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movsd  0xdf5(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xdd8(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xdd3(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xdbe(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xda9(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x80,-0x4c(%rbp)
movl   $0x10,-0x50(%rbp)
movl   $0x1,-0x54(%rbp)
mov    $0x0,%al
call   10f0 <print_banner@plt>
cmpl   $0x0,-0x8(%rbp)
jle    129b <main+0xab>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1070 <parse_control@plt>
mov    -0x1c(%rbp),%esi
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    12fa <main+0x10a>
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0x54(%rbp),%rdi
lea    -0x4c(%rbp),%rsi
call   10d0 <gamess_get_nmodes_nbas@plt>
mov    -0x14(%rbp),%edi
mov    -0x54(%rbp),%esi
mov    -0x54(%rbp),%eax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
mov    -0x4c(%rbp),%ecx
call   1040 <gamess_1d@plt>
jmp    1693 <main+0x4a3>
mov    -0x14(%rbp),%eax
mov    %eax,-0x58(%rbp)
test   %eax,%eax
je     132f <main+0x13f>
jmp    130d <main+0x11d>
mov    -0x58(%rbp),%eax
sub    $0x1,%eax
je     1351 <main+0x161>
jmp    131e <main+0x12e>
mov    -0x58(%rbp),%eax
sub    $0x2,%eax
je     1377 <main+0x187>
jmp    1399 <main+0x1a9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x48(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   10b0 <parse_harmonic@plt>
jmp    13bd <main+0x1cd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x4c(%rbp),%rcx
lea    -0x28(%rbp),%r8
lea    -0x30(%rbp),%r9
call   10e0 <parse_morse@plt>
jmp    13bd <main+0x1cd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   1030 <parse_1d@plt>
jmp    13bd <main+0x1cd>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x48(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   10b0 <parse_harmonic@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  %xmm1,%xmm0
mov    -0x4c(%rbp),%eax
add    $0xffffffff,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xc54(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x5d(%rbp)
call   1090 <printf@plt>
mov    -0x5d(%rbp),%al
lea    0xc59(%rip),%rdi
call   1090 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x5c(%rbp)
test   %eax,%eax
je     1433 <main+0x243>
jmp    1411 <main+0x221>
mov    -0x5c(%rbp),%eax
sub    $0x1,%eax
je     144b <main+0x25b>
jmp    1422 <main+0x232>
mov    -0x5c(%rbp),%eax
sub    $0x2,%eax
je     1468 <main+0x278>
jmp    1476 <main+0x286>
movsd  -0x48(%rbp),%xmm0
lea    0xc1e(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
jmp    1476 <main+0x286>
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
lea    0xc1a(%rip),%rdi
mov    $0x2,%al
call   1090 <printf@plt>
jmp    1476 <main+0x286>
lea    0xc2c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xc22(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x64(%rbp)
test   %eax,%eax
je     14b9 <main+0x2c9>
jmp    1497 <main+0x2a7>
mov    -0x64(%rbp),%eax
sub    $0x1,%eax
je     14cc <main+0x2dc>
jmp    14a8 <main+0x2b8>
mov    -0x64(%rbp),%eax
sub    $0x2,%eax
je     14df <main+0x2ef>
jmp    14ed <main+0x2fd>
lea    0xbef(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    14ed <main+0x2fd>
lea    0xbe6(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    14ed <main+0x2fd>
lea    0xbdc(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
mov    -0x4c(%rbp),%esi
lea    0xbc4(%rip),%rdi
mov    $0x3,%al
call   1090 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x68(%rbp)
test   %eax,%eax
je     1542 <main+0x352>
jmp    1520 <main+0x330>
mov    -0x68(%rbp),%eax
sub    $0x1,%eax
je     155e <main+0x36e>
jmp    1531 <main+0x341>
mov    -0x68(%rbp),%eax
sub    $0x2,%eax
je     15f6 <main+0x406>
jmp    168e <main+0x49e>
movsd  -0x48(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
mov    -0x4c(%rbp),%edi
call   10a0 <harmonic@plt>
jmp    168e <main+0x49e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x6c(%rbp)
test   %eax,%eax
je     1593 <main+0x3a3>
jmp    1571 <main+0x381>
mov    -0x6c(%rbp),%eax
sub    $0x1,%eax
je     15b4 <main+0x3c4>
jmp    1582 <main+0x392>
mov    -0x6c(%rbp),%eax
sub    $0x2,%eax
je     15d5 <main+0x3e5>
jmp    15f1 <main+0x401>
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
mov    -0x4c(%rbp),%edi
call   1060 <morse@plt>
jmp    15f1 <main+0x401>
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
mov    -0x4c(%rbp),%edi
call   1110 <morse_polynom@plt>
jmp    15f1 <main+0x401>
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
mov    -0x4c(%rbp),%edi
call   1100 <morse_points@plt>
jmp    168e <main+0x49e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x70(%rbp)
test   %eax,%eax
je     162b <main+0x43b>
jmp    1609 <main+0x419>
mov    -0x70(%rbp),%eax
sub    $0x1,%eax
je     164d <main+0x45d>
jmp    161a <main+0x42a>
mov    -0x70(%rbp),%eax
sub    $0x2,%eax
je     166f <main+0x47f>
jmp    1689 <main+0x499>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
movsd  -0x28(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
call   1050 <one_d@plt>
jmp    1689 <main+0x499>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
movsd  -0x28(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mov    -0x4c(%rbp),%esi
mov    -0x50(%rbp),%edx
call   10c0 <one_d_polynom@plt>
jmp    1689 <main+0x499>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
movsd  -0x28(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mov    -0x4c(%rbp),%esi
call   1080 <one_d_points@plt>
jmp    168e <main+0x49e>
jmp    1693 <main+0x4a3>
lea    0xa6d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
movl   $0x0,0x1c(%rsp)
movl   $0x0,0x34(%rsp)
movl   $0x0,0x3c(%rsp)
movabs $0xc028000000000000,%rax
mov    %rax,0x10(%rsp)
movabs $0x4028000000000000,%rax
mov    %rax,0x40(%rsp)
mov    %rax,0x48(%rsp)
movabs $0x3fe0000000000000,%rax
mov    %rax,0x28(%rsp)
movl   $0x80,0xc(%rsp)
movl   $0x10,0x38(%rsp)
movl   $0x1,0x54(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
call   1100 <print_banner@plt>
test   %ebx,%ebx
jle    1298 <main+0x98>
mov    0x8(%r14),%rdi
lea    0x1c(%rsp),%rsi
lea    0x34(%rsp),%rdx
lea    0x3c(%rsp),%rcx
call   1080 <parse_control@plt>
mov    0x3c(%rsp),%ebp
lea    0xd61(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   10a0 <printf@plt>
cmpl   $0x1,0x3c(%rsp)
jne    1301 <main+0x101>
lea    0xe39(%rip),%rdi
call   1050 <puts@plt>
lea    0x54(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   10e0 <gamess_get_nmodes_nbas@plt>
mov    0x1c(%rsp),%edi
mov    0x54(%rsp),%esi
lea    -0x1(%rsi),%eax
imul   %esi,%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
mov    0xc(%rsp),%ecx
call   1040 <gamess_1d@plt>
lea    0xdd5(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x1c(%rsp),%eax
cmp    $0x2,%eax
je     133a <main+0x13a>
cmp    $0x1,%eax
je     1359 <main+0x159>
test   %eax,%eax
je     131b <main+0x11b>
movl   $0x0,0x1c(%rsp)
mov    0x8(%r14),%rdi
lea    0x28(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x40(%rsp),%r8
call   10c0 <parse_harmonic@plt>
jmp    137b <main+0x17b>
mov    0x8(%r14),%rdi
lea    0x38(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x40(%rsp),%r8
call   1030 <parse_1d@plt>
jmp    137b <main+0x17b>
mov    0x8(%r14),%rdi
lea    0x48(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0x40(%rsp),%r9
call   10f0 <parse_morse@plt>
movsd  0x40(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x58(%rsp)
lea    0xcfc(%rip),%rdi
call   1050 <puts@plt>
lea    0xc5a(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    0x1c(%rsp),%eax
cmp    $0x2,%eax
je     13e3 <main+0x1e3>
cmp    $0x1,%eax
je     13f1 <main+0x1f1>
test   %eax,%eax
jne    140b <main+0x20b>
movsd  0x28(%rsp),%xmm0
lea    0xc3f(%rip),%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
jmp    140b <main+0x20b>
lea    0xcd2(%rip),%rdi
call   1050 <puts@plt>
jmp    140b <main+0x20b>
movsd  0x48(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
lea    0xc2e(%rip),%rdi
mov    $0x2,%al
call   10a0 <printf@plt>
movsd  0x20(%rsp),%xmm0
divsd  0x58(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0xc33(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
movslq 0x34(%rsp),%rax
cmp    $0x2,%rax
ja     1449 <main+0x249>
lea    0xcbf(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1050 <puts@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
mov    0xc(%rsp),%esi
lea    0xc07(%rip),%rdi
movsd  0x20(%rsp),%xmm2
mov    $0x3,%al
call   10a0 <printf@plt>
mov    0x1c(%rsp),%eax
cmp    $0x2,%eax
je     14a3 <main+0x2a3>
cmp    $0x1,%eax
je     14df <main+0x2df>
test   %eax,%eax
jne    12ea <main+0xea>
movsd  0x28(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    0xc(%rsp),%edi
movsd  0x20(%rsp),%xmm2
call   10b0 <harmonic@plt>
jmp    12ea <main+0xea>
mov    0x34(%rsp),%eax
cmp    $0x2,%eax
je     151f <main+0x31f>
cmp    $0x1,%eax
je     153d <main+0x33d>
test   %eax,%eax
jne    12ea <main+0xea>
mov    0x8(%r14),%rdi
movsd  0x10(%rsp),%xmm0
mov    0xc(%rsp),%esi
mov    0x38(%rsp),%edx
movsd  0x20(%rsp),%xmm1
call   1060 <one_d@plt>
jmp    12ea <main+0xea>
mov    0x34(%rsp),%eax
cmp    $0x2,%eax
je     155f <main+0x35f>
cmp    $0x1,%eax
je     1585 <main+0x385>
test   %eax,%eax
jne    12ea <main+0xea>
movsd  0x48(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
mov    0xc(%rsp),%edi
movsd  0x20(%rsp),%xmm3
call   1070 <morse@plt>
jmp    12ea <main+0xea>
mov    0x8(%r14),%rdi
movsd  0x10(%rsp),%xmm0
mov    0xc(%rsp),%esi
movsd  0x20(%rsp),%xmm1
call   1090 <one_d_points@plt>
jmp    12ea <main+0xea>
mov    0x8(%r14),%rdi
movsd  0x10(%rsp),%xmm0
mov    0xc(%rsp),%esi
mov    0x38(%rsp),%edx
movsd  0x20(%rsp),%xmm1
call   10d0 <one_d_polynom@plt>
jmp    12ea <main+0xea>
movsd  0x48(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
mov    0xc(%rsp),%edi
movsd  0x20(%rsp),%xmm3
call   1110 <morse_points@plt>
jmp    12ea <main+0xea>
movsd  0x48(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
mov    0xc(%rsp),%edi
movsd  0x20(%rsp),%xmm3
call   1120 <morse_polynom@plt>
jmp    12ea <main+0xea>

LLVM IR (-O0):
@.str = [14 x i8] c"friend = %2d\0A\00"
@.str.1 = [11 x i8] c"in friend\0A\00"
@.str.2 = [25 x i8] c"\0A Starting parameters :\0A\00"
@.str.3 = [11 x i8] c" task = \00"
@.str.4 = [25 x i8] c"harmonic\0A w = %10g\0A\00"
@.str.5 = [37 x i8] c"morse\0A d = %10g\0A w = %10g\0A\00"
@.str.6 = [4 x i8] c"1D\0A\00"
@.str.7 = [16 x i8] c" potential = \00"
@.str.8 = [10 x i8] c"analytic\0A\00"
@.str.9 = [9 x i8] c"polynom\0A\00"
@.str.10 = [8 x i8] c"points\0A\00"
@.str.11 = [61 x i8] c" xstart = %10g\0A xend = %10g\0A deltax = %10g\0A nbas = %10d\0A\00"
@.str.12 = [25 x i8] c"\0A All done!\0A\0A Arevoir!\0A\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 double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store double -1.200000e+01, double* %9
store double 1.200000e+01, double* %10
store double 2.000000e-01, double* %11
store double 1.200000e+01, double* %12
store double 5.000000e-01, double* %13
store i32 128, i32* %14
store i32 16, i32* %15
store i32 1, i32* %16
%17 = call i32 (...) @print_banner()
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @parse_control(i8* %23, i32* %6, i32* %7, i32* %8)
br label %25
25: ; preds = %20, %2
%26 = load i32, i32* %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %8
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %42
30: ; preds = %25
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 @gamess_get_nmodes_nbas(i32* %16, i32* %14)
%33 = load i32, i32* %6
%34 = load i32, i32* %16
%35 = load i32, i32* %16
%36 = load i32, i32* %16
%37 = sub nsw i32 %36, 1
%38 = mul nsw i32 %35, %37
%39 = sdiv i32 %38, 2
%40 = load i32, i32* %14
%41 = call i32 @gamess_1d(i32 %33, i32 %34, i32 %39, i32 %40)
br label %160
42: ; preds = %25
%43 = load i32, i32* %6
switch i32 %43, label %59 [
i32 0, label %44
i32 1, label %49
i32 2, label %54
]
44: ; preds = %42
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = call i32 @parse_harmonic(i8* %47, double* %13, i32* %14, double* %9, double* %10)
br label %64
49: ; preds = %42
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = call i32 @parse_morse(i8* %52, double* %12, double* %13, i32* %14, double* %9, double* %10)
br label %64
54: ; preds = %42
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 1
%57 = load i8*, i8** %56
%58 = call i32 @parse_1d(i8* %57, i32* %15, i32* %14, double* %9, double* %10)
br label %64
59: ; preds = %42
store i32 0, i32* %6
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 1
%62 = load i8*, i8** %61
%63 = call i32 @parse_harmonic(i8* %62, double* %13, i32* %14, double* %9, double* %10)
br label %64
64: ; preds = %59, %54, %49, %44
%65 = load double, double* %10
%66 = load double, double* %9
%67 = fsub double %65, %66
%68 = load i32, i32* %14
%69 = sub nsw i32 %68, 1
%70 = sitofp i32 %69 to double
%71 = fdiv double %67, %70
store double %71, double* %11
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%74 = load i32, i32* %6
switch i32 %74, label %84 [
i32 0, label %75
i32 1, label %78
i32 2, label %82
]
75: ; preds = %64
%76 = load double, double* %13
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), double %76)
br label %84
78: ; preds = %64
%79 = load double, double* %12
%80 = load double, double* %13
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), double %79, double %80)
br label %84
82: ; preds = %64
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %84
84: ; preds = %64, %82, %78, %75
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%86 = load i32, i32* %7
switch i32 %86, label %93 [
i32 0, label %87
i32 1, label %89
i32 2, label %91
]
87: ; preds = %84
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
br label %93
89: ; preds = %84
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %93
91: ; preds = %84
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %93
93: ; preds = %84, %91, %89, %87
%94 = load double, double* %9
%95 = load double, double* %10
%96 = load double, double* %11
%97 = load i32, i32* %14
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.11, i64 0, i64 0), double %94, double %95, double %96, i32 %97)
%99 = load i32, i32* %6
switch i32 %99, label %159 [
i32 0, label %100
i32 1, label %106
i32 2, label %130
]
100: ; preds = %93
%101 = load double, double* %13
%102 = load double, double* %9
%103 = load double, double* %11
%104 = load i32, i32* %14
%105 = call i32 @harmonic(double %101, double %102, double %103, i32 %104)
br label %159
106: ; preds = %93
%107 = load i32, i32* %7
switch i32 %107, label %129 [
i32 0, label %108
i32 1, label %115
i32 2, label %122
]
108: ; preds = %106
%109 = load double, double* %12
%110 = load double, double* %13
%111 = load double, double* %9
%112 = load double, double* %11
%113 = load i32, i32* %14
%114 = call i32 @morse(double %109, double %110, double %111, double %112, i32 %113)
br label %129
115: ; preds = %106
%116 = load double, double* %12
%117 = load double, double* %13
%118 = load double, double* %9
%119 = load double, double* %11
%120 = load i32, i32* %14
%121 = call i32 @morse_polynom(double %116, double %117, double %118, double %119, i32 %120)
br label %129
122: ; preds = %106
%123 = load double, double* %12
%124 = load double, double* %13
%125 = load double, double* %9
%126 = load double, double* %11
%127 = load i32, i32* %14
%128 = call i32 @morse_points(double %123, double %124, double %125, double %126, i32 %127)
br label %129
129: ; preds = %106, %122, %115, %108
br label %159
130: ; preds = %93
%131 = load i32, i32* %7
switch i32 %131, label %158 [
i32 0, label %132
i32 1, label %141
i32 2, label %150
]
132: ; preds = %130
%133 = load i8**, i8*** %5
%134 = getelementptr inbounds i8*, i8** %133, i64 1
%135 = load i8*, i8** %134
%136 = load double, double* %9
%137 = load double, double* %11
%138 = load i32, i32* %14
%139 = load i32, i32* %15
%140 = call i32 @one_d(i8* %135, double %136, double %137, i32 %138, i32 %139)
br label %158
141: ; preds = %130
%142 = load i8**, i8*** %5
%143 = getelementptr inbounds i8*, i8** %142, i64 1
%144 = load i8*, i8** %143
%145 = load double, double* %9
%146 = load double, double* %11
%147 = load i32, i32* %14
%148 = load i32, i32* %15
%149 = call i32 @one_d_polynom(i8* %144, double %145, double %146, i32 %147, i32 %148)
br label %158
150: ; preds = %130
%151 = load i8**, i8*** %5
%152 = getelementptr inbounds i8*, i8** %151, i64 1
%153 = load i8*, i8** %152
%154 = load double, double* %9
%155 = load double, double* %11
%156 = load i32, i32* %14
%157 = call i32 @one_d_points(i8* %153, double %154, double %155, i32 %156)
br label %158
158: ; preds = %130, %150, %141, %132
br label %159
159: ; preds = %158, %93, %129, %100
br label %160
160: ; preds = %159, %30
%161 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"friend = %2d\0A\00"
@.str.3 = [11 x i8] c" task = \00"
@.str.4 = [25 x i8] c"harmonic\0A w = %10g\0A\00"
@.str.5 = [37 x i8] c"morse\0A d = %10g\0A w = %10g\0A\00"
@.str.7 = [16 x i8] c" potential = \00"
@.str.11 = [61 x i8] c" xstart = %10g\0A xend = %10g\0A deltax = %10g\0A nbas = %10d\0A\00"
@str = [24 x i8] c"\0A Starting parameters :\00"
@str.13 = [3 x i8] c"1D\00"
@str.14 = [7 x i8] c"points\00"
@str.15 = [24 x i8] c"\0A All done!\0A\0A Arevoir!\0A\00"
@str.16 = [8 x i8] c"polynom\00"
@str.17 = [9 x i8] c"analytic\00"
@str.18 = [10 x i8] c"in friend\00"
@reltable.main = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @str.17 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @str.16 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @str.14 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32)]
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%14 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%15 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%16 = bitcast double* %6 to i8*
store double -1.200000e+01, double* %6
%17 = bitcast double* %7 to i8*
store double 1.200000e+01, double* %7
%18 = bitcast double* %8 to i8*
store double 1.200000e+01, double* %8
%19 = bitcast double* %9 to i8*
store double 5.000000e-01, double* %9
%20 = bitcast i32* %10 to i8*
store i32 128, i32* %10
%21 = bitcast i32* %11 to i8*
store i32 16, i32* %11
%22 = bitcast i32* %12 to i8*
store i32 1, i32* %12
%23 = tail call i32 (...) @print_banner()
%24 = icmp sgt i32 %0, 0
br i1 %24, label %25, label %30
25: ; preds = %2
%26 = getelementptr inbounds i8*, i8** %1, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @parse_control(i8* %27, i32* %3, i32* %4, i32* %5)
%29 = load i32, i32* %5
br label %30
30: ; preds = %25, %2
%31 = phi i32 [ %29, %25 ], [ 0, %2 ]
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %5
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %45
35: ; preds = %30
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.18, i64 0, i64 0))
%37 = call i32 @gamess_get_nmodes_nbas(i32* %12, i32* %10)
%38 = load i32, i32* %3
%39 = load i32, i32* %12
%40 = add nsw i32 %39, -1
%41 = mul nsw i32 %40, %39
%42 = sdiv i32 %41, 2
%43 = load i32, i32* %10
%44 = call i32 @gamess_1d(i32 %38, i32 %39, i32 %42, i32 %43)
br label %145
45: ; preds = %30
%46 = load i32, i32* %3
switch i32 %46, label %59 [
i32 0, label %47
i32 1, label %51
i32 2, label %55
]
47: ; preds = %45
%48 = getelementptr inbounds i8*, i8** %1, i64 1
%49 = load i8*, i8** %48
%50 = call i32 @parse_harmonic(i8* %49, double* %9, i32* %10, double* %6, double* %7)
br label %63
51: ; preds = %45
%52 = getelementptr inbounds i8*, i8** %1, i64 1
%53 = load i8*, i8** %52
%54 = call i32 @parse_morse(i8* %53, double* %8, double* %9, i32* %10, double* %6, double* %7)
br label %63
55: ; preds = %45
%56 = getelementptr inbounds i8*, i8** %1, i64 1
%57 = load i8*, i8** %56
%58 = call i32 @parse_1d(i8* %57, i32* %11, i32* %10, double* %6, double* %7)
br label %63
59: ; preds = %45
store i32 0, i32* %3
%60 = getelementptr inbounds i8*, i8** %1, i64 1
%61 = load i8*, i8** %60
%62 = call i32 @parse_harmonic(i8* %61, double* %9, i32* %10, double* %6, double* %7)
br label %63
63: ; preds = %59, %55, %51, %47
%64 = load double, double* %7
%65 = load double, double* %6
%66 = fsub double %64, %65
%67 = load i32, i32* %10
%68 = add nsw i32 %67, -1
%69 = sitofp i32 %68 to double
%70 = fdiv double %66, %69
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%73 = load i32, i32* %3
switch i32 %73, label %83 [
i32 0, label %74
i32 1, label %77
i32 2, label %81
]
74: ; preds = %63
%75 = load double, double* %9
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), double %75)
br label %83
77: ; preds = %63
%78 = load double, double* %8
%79 = load double, double* %9
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), double %78, double %79)
br label %83
81: ; preds = %63
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.13, i64 0, i64 0))
br label %83
83: ; preds = %63, %81, %77, %74
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%85 = load i32, i32* %4
%86 = icmp ult i32 %85, 3
br i1 %86, label %87, label %92
87: ; preds = %83
%88 = sext i32 %85 to i64
%89 = shl i64 %88, 2
%90 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main to i8*), i64 %89)
%91 = call i32 @puts(i8* dereferenceable(1) %90)
br label %92
92: ; preds = %83, %87
%93 = load double, double* %6
%94 = load double, double* %7
%95 = load i32, i32* %10
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.11, i64 0, i64 0), double %93, double %94, double %70, i32 %95)
%97 = load i32, i32* %3
switch i32 %97, label %145 [
i32 0, label %98
i32 1, label %103
i32 2, label %123
]
98: ; preds = %92
%99 = load double, double* %9
%100 = load double, double* %6
%101 = load i32, i32* %10
%102 = call i32 @harmonic(double %99, double %100, double %70, i32 %101)
br label %145
103: ; preds = %92
%104 = load i32, i32* %4
switch i32 %104, label %145 [
i32 0, label %105
i32 1, label %111
i32 2, label %117
]
105: ; preds = %103
%106 = load double, double* %8
%107 = load double, double* %9
%108 = load double, double* %6
%109 = load i32, i32* %10
%110 = call i32 @morse(double %106, double %107, double %108, double %70, i32 %109)
br label %145
111: ; preds = %103
%112 = load double, double* %8
%113 = load double, double* %9
%114 = load double, double* %6
%115 = load i32, i32* %10
%116 = call i32 @morse_polynom(double %112, double %113, double %114, double %70, i32 %115)
br label %145
117: ; preds = %103
%118 = load double, double* %8
%119 = load double, double* %9
%120 = load double, double* %6
%121 = load i32, i32* %10
%122 = call i32 @morse_points(double %118, double %119, double %120, double %70, i32 %121)
br label %145
123: ; preds = %92
%124 = load i32, i32* %4
switch i32 %124, label %145 [
i32 0, label %125
i32 1, label %132
i32 2, label %139
]
125: ; preds = %123
%126 = getelementptr inbounds i8*, i8** %1, i64 1
%127 = load i8*, i8** %126
%128 = load double, double* %6
%129 = load i32, i32* %10
%130 = load i32, i32* %11
%131 = call i32 @one_d(i8* %127, double %128, double %70, i32 %129, i32 %130)
br label %145
132: ; preds = %123
%133 = getelementptr inbounds i8*, i8** %1, i64 1
%134 = load i8*, i8** %133
%135 = load double, double* %6
%136 = load i32, i32* %10
%137 = load i32, i32* %11
%138 = call i32 @one_d_polynom(i8* %134, double %135, double %70, i32 %136, i32 %137)
br label %145
139: ; preds = %123
%140 = getelementptr inbounds i8*, i8** %1, i64 1
%141 = load i8*, i8** %140
%142 = load double, double* %6
%143 = load i32, i32* %10
%144 = call i32 @one_d_points(i8* %141, double %142, double %70, i32 %143)
br label %145
145: ; preds = %98, %92, %103, %117, %111, %105, %123, %139, %132, %125, %35
%146 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.15, i64 0, i64 0))
ret i32 0
}