#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
scalar_t__ strcasecmp(char const *, char *);
int /*<<< orphan*/ system(char *);
void runmelts(const char prefix[], double sc[], const char version[],
              const char mode[], const char fo2Path[], double fo2Delta,
              const char batchString[], const char saveAll[],
              const char fractionateSolids[], double Ti, double Pi, double dT,
              double dP, double massin) {
  char fractionateWater[2] = "!", celciusOutput[2] = "", ptpath[2] = "!";
  if (strcasecmp(mode, "ptpath") == 0)
    ptpath[0] = '\0';
  double Pmax = 90000, Pmin = 1, Tmax = 3000, Tmin = 600;
  FILE *fp;
  char path_string[100];
  double normconst = 0;
  int i;
  for (i = 0; i < 16; i++) {
    normconst = normconst + sc[i];
  }
  for (i = 0; i < 16; i++) {
    sc[i] = sc[i] * 100 / normconst;
  }
  sprintf(path_string, "%ssc.melts", prefix);
  fp = fopen(path_string, "w");
  fprintf(
      fp,
      "Title: dummy			\nInitial Composition: SiO2 "
      "%.4f			\nInitial Composition: TiO2 %.4f	"
      "		\nInitial Composition: Al2O3 %.4f			"
      "\nInitial Composition: Fe2O3 %.4f			\nInitial "
      "Composition: Cr2O3 %.4f			\nInitial Composition: FeO "
      "%.4f			\nInitial Composition: MnO %.4f		"
      "	\nInitial Composition: MgO %.4f			\nInitial Composition: "
      "NiO %.4f			\nInitial Composition: CoO %.4f		"
      "	\nInitial Composition: CaO %.4f			\nInitial Composition: "
      "Na2O %.4f			\nInitial Composition: K2O %.4f	"
      "		\nInitial Composition: P2O5 %.4f			"
      "\nInitial Composition: CO2 %.4f			\nInitial Composition: "
      "H2O %.4f\n",
      sc[0], sc[1], sc[2], sc[3], sc[4], sc[5], sc[6], sc[7], sc[8], sc[9],
      sc[10], sc[11], sc[12], sc[13], sc[14], sc[15]);
  fprintf(fp,
          "Initial Temperature: %.2f			\nInitial Pressure: "
          "%.2f			\nlog fo2 Path: %s\n",
          Ti, Pi, fo2Path);
  if (fo2Delta != 0) {
    fprintf(fp, "log fo2 Delta: %.2f\n", fo2Delta);
  }
  fclose(fp);
  sprintf(path_string, "%smelts_env", prefix);
  fp = fopen(path_string, "w");
  fprintf(fp,
          "\nALPHAMELTS_VERSION\t\t%s			"
          "\nALPHAMELTS_MODE\t\t\t%s			"
          "\n%sALPHAMELTS_PTPATH_FILE\t\tptpath			"
          "\nALPHAMELTS_DELTAP\t\t%.0f			"
          "\nALPHAMELTS_DELTAT\t\t%.0f			"
          "\nALPHAMELTS_MAXP\t\t\t%.0f			"
          "\nALPHAMELTS_MINP\t\t\t%.0f			"
          "\nALPHAMELTS_MAXT\t\t\t%.0f			"
          "\nALPHAMELTS_MINT\t\t\t%.0f			"
          "\n%sALPHAMELTS_FRACTIONATE_SOLIDS\ttrue			"
          "\n%sALPHAMELTS_MASSIN\t\t%g			"
          "\n%sALPHAMELTS_FRACTIONATE_WATER\ttrue			"
          "\n%sALPHAMELTS_MINW\t\t\t0.005			"
          "\n%sALPHAMELTS_SAVE_ALL\t\ttrue			"
          "\n%sALPHAMELTS_CELSIUS_OUTPUT\ttrue\n",
          version, mode, ptpath, dP, dT, Pmax, Pmin, Tmax, Tmin,
          fractionateSolids, fractionateSolids, massin, fractionateWater,
          fractionateWater, saveAll, celciusOutput);
  fclose(fp);
  sprintf(path_string, "%sbatch", prefix);
  fp = fopen(path_string, "w");
  fputs(batchString, fp);
  fclose(fp);
  char cmd_string[200];
  sprintf(cmd_string,
          "cd %s; run_alphamelts_v1.41.pl -f melts_env -b batch > /dev/null",
          prefix);
  system(cmd_string);
}


x86 assembly (clang, -O0):
<runmelts>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x220,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
movsd  %xmm0,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
movsd  %xmm1,-0x50(%rbp)
movsd  %xmm2,-0x58(%rbp)
movsd  %xmm3,-0x60(%rbp)
movsd  %xmm4,-0x68(%rbp)
movsd  %xmm5,-0x70(%rbp)
mov    0xe55(%rip),%ax
mov    %ax,-0x72(%rbp)
lea    -0x74(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1070 <memset@plt>
mov    0xe3a(%rip),%ax
mov    %ax,-0x76(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1210 <runmelts+0x90>
movb   $0x0,-0x76(%rbp)
movsd  0xe00(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xdeb(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xdd3(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xdbb(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
movl   $0x0,-0x11c(%rbp)
cmpl   $0x10,-0x11c(%rbp)
jge    12a3 <runmelts+0x123>
movsd  -0x118(%rbp),%xmm0
ff
mov    -0x20(%rbp),%rax
movslq -0x11c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
jmp    1262 <runmelts+0xe2>
movl   $0x0,-0x11c(%rbp)
cmpl   $0x10,-0x11c(%rbp)
jge    12fe <runmelts+0x17e>
mov    -0x20(%rbp),%rax
movslq -0x11c(%rbp),%rcx
movsd  0xd53(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
divsd  -0x118(%rbp),%xmm0
ff
mov    -0x20(%rbp),%rax
movslq -0x11c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x11c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x11c(%rbp)
jmp    12ad <runmelts+0x12d>
lea    -0x110(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd21(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xd19(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rdi
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm3
mov    -0x20(%rbp),%rax
movsd  0x20(%rax),%xmm4
mov    -0x20(%rbp),%rax
movsd  0x28(%rax),%xmm5
mov    -0x20(%rbp),%rax
movsd  0x30(%rax),%xmm6
mov    -0x20(%rbp),%rax
movsd  0x38(%rax),%xmm7
mov    -0x20(%rbp),%rax
movsd  0x40(%rax),%xmm15
mov    -0x20(%rbp),%rax
movsd  0x48(%rax),%xmm14
mov    -0x20(%rbp),%rax
movsd  0x50(%rax),%xmm13
mov    -0x20(%rbp),%rax
movsd  0x58(%rax),%xmm12
mov    -0x20(%rbp),%rax
movsd  0x60(%rax),%xmm11
mov    -0x20(%rbp),%rax
movsd  0x68(%rax),%xmm10
mov    -0x20(%rbp),%rax
movsd  0x70(%rax),%xmm9
mov    -0x20(%rbp),%rax
movsd  0x78(%rax),%xmm8
lea    0xc6a(%rip),%rsi
movsd  %xmm15,(%rsp)
movsd  %xmm14,0x8(%rsp)
movsd  %xmm13,0x10(%rsp)
movsd  %xmm12,0x18(%rsp)
movsd  %xmm11,0x20(%rsp)
movsd  %xmm10,0x28(%rsp)
movsd  %xmm9,0x30(%rsp)
movsd  %xmm8,0x38(%rsp)
mov    $0x8,%al
call   1080 <fprintf@plt>
mov    -0xa0(%rbp),%rdi
movsd  -0x50(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
mov    -0x38(%rbp),%rdx
lea    0xe38(%rip),%rsi
mov    $0x2,%al
call   1080 <fprintf@plt>
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1452 <runmelts+0x2d2>
jp     1452 <runmelts+0x2d2>
jmp    146c <runmelts+0x2ec>
mov    -0xa0(%rbp),%rdi
movsd  -0x40(%rbp),%xmm0
lea    0xe4a(%rip),%rsi
mov    $0x1,%al
call   1080 <fprintf@plt>
mov    -0xa0(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x110(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe3a(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xb9f(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    -0x76(%rbp),%r8
movsd  -0x68(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm2
movsd  -0x88(%rbp),%xmm3
ff
movsd  -0x90(%rbp),%xmm4
ff
movsd  -0x98(%rbp),%xmm5
ff
mov    0x18(%rbp),%r9
mov    0x18(%rbp),%r14
movsd  -0x70(%rbp),%xmm6
lea    -0x72(%rbp),%rbx
lea    -0x72(%rbp),%r11
mov    0x10(%rbp),%r10
lea    -0x74(%rbp),%rax
lea    0xdc9(%rip),%rsi
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
mov    $0x7,%al
call   1080 <fprintf@plt>
mov    -0xa0(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x110(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xf49(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xae5(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xa0(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
call   1060 <fputs@plt>
mov    -0xa0(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x1f0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xf04(%rip),%rsi
call   10a0 <sprintf@plt>
lea    -0x1f0(%rbp),%rdi
call   1050 <system@plt>
add    $0x220,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<runmelts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x188,%rsp
movsd  %xmm5,0x40(%rsp)
movsd  %xmm4,0x30(%rsp)
movsd  %xmm3,0x38(%rsp)
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
mov    %r9,0x48(%rsp)
movsd  %xmm0,0x20(%rsp)
mov    %r8,%rbp
mov    %rcx,%r15
mov    %rdx,0x28(%rsp)
mov    %rsi,%r12
mov    %rdi,%r13
movw   $0x21,0xe(%rsp)
movw   $0x0,0xc(%rsp)
movw   $0x21,0xa(%rsp)
lea    0xe61(%rip),%rsi
mov    %rcx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
jne    11e9 <runmelts+0x79>
movb   $0x0,0xa(%rsp)
movupd (%r12),%xmm3
movupd 0x10(%r12),%xmm2
movupd 0x20(%r12),%xmm10
movupd 0x30(%r12),%xmm8
xorpd  %xmm1,%xmm1
movapd %xmm3,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm3,%xmm4
unpckhpd %xmm3,%xmm4
addsd  %xmm0,%xmm4
addsd  %xmm2,%xmm4
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
addsd  %xmm4,%xmm0
addsd  %xmm10,%xmm0
movapd %xmm10,%xmm4
unpckhpd %xmm10,%xmm4
addsd  %xmm0,%xmm4
addsd  %xmm8,%xmm4
movapd %xmm8,%xmm0
unpckhpd %xmm8,%xmm0
addsd  %xmm4,%xmm0
movupd 0x40(%r12),%xmm4
addsd  %xmm4,%xmm0
movapd %xmm4,%xmm6
unpckhpd %xmm4,%xmm6
addsd  %xmm0,%xmm6
movupd 0x50(%r12),%xmm5
addsd  %xmm5,%xmm6
movapd %xmm5,%xmm0
unpckhpd %xmm5,%xmm0
addsd  %xmm6,%xmm0
movupd 0x60(%r12),%xmm1
addsd  %xmm1,%xmm0
movapd %xmm1,%xmm6
unpckhpd %xmm1,%xmm6
addsd  %xmm0,%xmm6
movupd 0x70(%r12),%xmm0
addsd  %xmm0,%xmm6
movapd %xmm0,%xmm7
unpckhpd %xmm0,%xmm7
addsd  %xmm6,%xmm7
movapd 0xd49(%rip),%xmm9
mulpd  %xmm9,%xmm3
unpcklpd %xmm7,%xmm7
divpd  %xmm7,%xmm3
movupd %xmm3,(%r12)
mulpd  %xmm9,%xmm2
divpd  %xmm7,%xmm2
movupd %xmm2,0x10(%r12)
mulpd  %xmm9,%xmm10
divpd  %xmm7,%xmm10
movupd %xmm10,0x20(%r12)
mulpd  %xmm9,%xmm8
divpd  %xmm7,%xmm8
movupd %xmm8,0x30(%r12)
mulpd  %xmm9,%xmm4
divpd  %xmm7,%xmm4
movupd %xmm4,0x40(%r12)
mulpd  %xmm9,%xmm5
divpd  %xmm7,%xmm5
movupd %xmm5,0x50(%r12)
mulpd  %xmm9,%xmm1
divpd  %xmm7,%xmm1
movupd %xmm1,0x60(%r12)
mulpd  %xmm9,%xmm0
divpd  %xmm7,%xmm0
movupd %xmm0,0x70(%r12)
lea    0xcfc(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rdx
call   1090 <sprintf@plt>
lea    0xcf0(%rip),%rsi
mov    %rbx,%rdi
call   1080 <fopen@plt>
mov    %rax,%r14
movsd  (%r12),%xmm0
movsd  0x8(%r12),%xmm1
movsd  0x10(%r12),%xmm2
movsd  0x18(%r12),%xmm3
movsd  0x20(%r12),%xmm4
movsd  0x28(%r12),%xmm5
movsd  0x30(%r12),%xmm6
movsd  0x38(%r12),%xmm7
movups 0x40(%r12),%xmm8
movups 0x50(%r12),%xmm9
movups 0x60(%r12),%xmm10
movups 0x70(%r12),%xmm11
sub    $0x40,%rsp
movups %xmm11,0x30(%rsp)
movups %xmm10,0x20(%rsp)
movups %xmm9,0x10(%rsp)
movups %xmm8,(%rsp)
lea    0xc76(%rip),%rsi
mov    %rax,%rdi
mov    $0x8,%al
call   1070 <fprintf@plt>
add    $0x40,%rsp
lea    0xe89(%rip),%rsi
mov    %r14,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    %rbp,%rdx
mov    $0x2,%al
call   1070 <fprintf@plt>
movsd  0x20(%rsp),%xmm0
ucomisd 0xc1e(%rip),%xmm0
jne    1416 <runmelts+0x2a6>
jnp    1427 <runmelts+0x2b7>
lea    0xea0(%rip),%rsi
mov    %r14,%rdi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
lea    0xe9c(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
mov    %r13,%rdx
call   1090 <sprintf@plt>
lea    0xbfd(%rip),%r14
mov    %rbp,%rdi
mov    %r14,%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
sub    $0x8,%rsp
lea    0x14(%rsp),%r10
lea    0x16(%rsp),%r11
lea    0xe6e(%rip),%rsi
lea    0x12(%rsp),%r8
movsd  0xb93(%rip),%xmm2
movsd  0xb93(%rip),%xmm3
movsd  0xb93(%rip),%xmm4
movsd  0xb93(%rip),%xmm5
mov    %rax,%rdi
mov    0x30(%rsp),%rdx
mov    %r15,%rcx
movsd  0x38(%rsp),%xmm0
movsd  0x40(%rsp),%xmm1
mov    0x1d0(%rsp),%r9
movsd  0x48(%rsp),%xmm6
mov    $0x7,%al
push   %r10
push   0x1d0(%rsp)
push   %r11
push   %r11
push   %r9
call   1070 <fprintf@plt>
add    $0x30,%rsp
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xfb8(%rip),%rsi
mov    %rbp,%rdi
mov    %r13,%rdx
call   1090 <sprintf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
mov    0x48(%rsp),%rdi
mov    %rax,%rsi
call   1060 <fputs@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xf8b(%rip),%rsi
lea    0xc0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
add    $0x188,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.runmelts.fractionateWater = [2 x i8] c"!\00"
@__const.runmelts.ptpath = [2 x i8] c"!\00"
@.str = [7 x i8] c"ptpath\00"
@.str.1 = [11 x i8] c"%ssc.melts\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [552 x i8] c"Title: dummy\09\09\09\0AInitial Composition: SiO2 %.4f\09\09\09\0AInitial Composition: TiO2 %.4f\09\09\09\0AInitial Composition: Al2O3 %.4f\09\09\09\0AInitial Composition: Fe2O3 %.4f\09\09\09\0AInitial Composition: Cr2O3 %.4f\09\09\09\0AInitial Composition: FeO %.4f\09\09\09\0AInitial Composition: MnO %.4f\09\09\09\0AInitial Composition: MgO %.4f\09\09\09\0AInitial Composition: NiO %.4f\09\09\09\0AInitial Composition: CoO %.4f\09\09\09\0AInitial Composition: CaO %.4f\09\09\09\0AInitial Composition: Na2O %.4f\09\09\09\0AInitial Composition: K2O %.4f\09\09\09\0AInitial Composition: P2O5 %.4f\09\09\09\0AInitial Composition: CO2 %.4f\09\09\09\0AInitial Composition: H2O %.4f\0A\00"
@.str.4 = [73 x i8] c"Initial Temperature: %.2f\09\09\09\0AInitial Pressure: %.2f\09\09\09\0Alog fo2 Path: %s\0A\00"
@.str.5 = [21 x i8] c"log fo2 Delta: %.2f\0A\00"
@.str.6 = [12 x i8] c"%smelts_env\00"
@.str.7 = [445 x i8] c"\0AALPHAMELTS_VERSION\09\09%s\09\09\09\0AALPHAMELTS_MODE\09\09\09%s\09\09\09\0A%sALPHAMELTS_PTPATH_FILE\09\09ptpath\09\09\09\0AALPHAMELTS_DELTAP\09\09%.0f\09\09\09\0AALPHAMELTS_DELTAT\09\09%.0f\09\09\09\0AALPHAMELTS_MAXP\09\09\09%.0f\09\09\09\0AALPHAMELTS_MINP\09\09\09%.0f\09\09\09\0AALPHAMELTS_MAXT\09\09\09%.0f\09\09\09\0AALPHAMELTS_MINT\09\09\09%.0f\09\09\09\0A%sALPHAMELTS_FRACTIONATE_SOLIDS\09true\09\09\09\0A%sALPHAMELTS_MASSIN\09\09%g\09\09\09\0A%sALPHAMELTS_FRACTIONATE_WATER\09true\09\09\09\0A%sALPHAMELTS_MINW\09\09\090.005\09\09\09\0A%sALPHAMELTS_SAVE_ALL\09\09true\09\09\09\0A%sALPHAMELTS_CELSIUS_OUTPUT\09true\0A\00"
@.str.8 = [8 x i8] c"%sbatch\00"
@.str.9 = [65 x i8] c"cd %s; run_alphamelts_v1.41.pl -f melts_env -b batch > /dev/null\00"
define void @runmelts(i8* %0, double* %1, i8* %2, i8* %3, i8* %4, double %5, i8* %6, i8* %7, i8* %8, double %9, double %10, double %11, double %12, double %13) {
%15 = alloca i8*
%16 = alloca double*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca double
%21 = alloca i8*
%22 = alloca i8*
%23 = alloca i8*
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca [2 x i8]
%30 = alloca [2 x i8]
%31 = alloca [2 x i8]
%32 = alloca double
%33 = alloca double
%34 = alloca double
%35 = alloca double
%36 = alloca i32*
%37 = alloca [100 x i8]
%38 = alloca double
%39 = alloca i32
%40 = alloca [200 x i8]
store i8* %0, i8** %15
store double* %1, double** %16
store i8* %2, i8** %17
store i8* %3, i8** %18
store i8* %4, i8** %19
store double %5, double* %20
store i8* %6, i8** %21
store i8* %7, i8** %22
store i8* %8, i8** %23
store double %9, double* %24
store double %10, double* %25
store double %11, double* %26
store double %12, double* %27
store double %13, double* %28
%41 = bitcast [2 x i8]* %29 to i8*
%42 = bitcast [2 x i8]* %30 to i8*
%43 = bitcast [2 x i8]* %31 to i8*
%44 = load i8*, i8** %18
%45 = call i64 @strcasecmp(i8* %44, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %14
%48 = getelementptr inbounds [2 x i8], [2 x i8]* %31, i64 0, i64 0
store i8 0, i8* %48
br label %49
49: ; preds = %47, %14
store double 9.000000e+04, double* %32
store double 1.000000e+00, double* %33
store double 3.000000e+03, double* %34
store double 6.000000e+02, double* %35
store double 0.000000e+00, double* %38
store i32 0, i32* %39
br label %50
50: ; preds = %61, %49
%51 = load i32, i32* %39
%52 = icmp slt i32 %51, 16
br i1 %52, label %53, label %64
53: ; preds = %50
%54 = load double, double* %38
%55 = load double*, double** %16
%56 = load i32, i32* %39
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %55, i64 %57
%59 = load double, double* %58
%60 = fadd double %54, %59
store double %60, double* %38
br label %61
61: ; preds = %53
%62 = load i32, i32* %39
%63 = add nsw i32 %62, 1
store i32 %63, i32* %39
br label %50
64: ; preds = %50
store i32 0, i32* %39
br label %65
65: ; preds = %81, %64
%66 = load i32, i32* %39
%67 = icmp slt i32 %66, 16
br i1 %67, label %68, label %84
68: ; preds = %65
%69 = load double*, double** %16
%70 = load i32, i32* %39
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
%73 = load double, double* %72
%74 = fmul double %73, 1.000000e+02
%75 = load double, double* %38
%76 = fdiv double %74, %75
%77 = load double*, double** %16
%78 = load i32, i32* %39
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double, double* %77, i64 %79
store double %76, double* %80
br label %81
81: ; preds = %68
%82 = load i32, i32* %39
%83 = add nsw i32 %82, 1
store i32 %83, i32* %39
br label %65
84: ; preds = %65
%85 = getelementptr inbounds [100 x i8], [100 x i8]* %37, i64 0, i64 0
%86 = load i8*, i8** %15
%87 = call i32 @sprintf(i8* %85, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %86)
%88 = getelementptr inbounds [100 x i8], [100 x i8]* %37, i64 0, i64 0
%89 = call i32* @fopen(i8* %88, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %89, i32** %36
%90 = load i32*, i32** %36
%91 = load double*, double** %16
%92 = getelementptr inbounds double, double* %91, i64 0
%93 = load double, double* %92
%94 = load double*, double** %16
%95 = getelementptr inbounds double, double* %94, i64 1
%96 = load double, double* %95
%97 = load double*, double** %16
%98 = getelementptr inbounds double, double* %97, i64 2
%99 = load double, double* %98
%100 = load double*, double** %16
%101 = getelementptr inbounds double, double* %100, i64 3
%102 = load double, double* %101
%103 = load double*, double** %16
%104 = getelementptr inbounds double, double* %103, i64 4
%105 = load double, double* %104
%106 = load double*, double** %16
%107 = getelementptr inbounds double, double* %106, i64 5
%108 = load double, double* %107
%109 = load double*, double** %16
%110 = getelementptr inbounds double, double* %109, i64 6
%111 = load double, double* %110
%112 = load double*, double** %16
%113 = getelementptr inbounds double, double* %112, i64 7
%114 = load double, double* %113
%115 = load double*, double** %16
%116 = getelementptr inbounds double, double* %115, i64 8
%117 = load double, double* %116
%118 = load double*, double** %16
%119 = getelementptr inbounds double, double* %118, i64 9
%120 = load double, double* %119
%121 = load double*, double** %16
%122 = getelementptr inbounds double, double* %121, i64 10
%123 = load double, double* %122
%124 = load double*, double** %16
%125 = getelementptr inbounds double, double* %124, i64 11
%126 = load double, double* %125
%127 = load double*, double** %16
%128 = getelementptr inbounds double, double* %127, i64 12
%129 = load double, double* %128
%130 = load double*, double** %16
%131 = getelementptr inbounds double, double* %130, i64 13
%132 = load double, double* %131
%133 = load double*, double** %16
%134 = getelementptr inbounds double, double* %133, i64 14
%135 = load double, double* %134
%136 = load double*, double** %16
%137 = getelementptr inbounds double, double* %136, i64 15
%138 = load double, double* %137
%139 = call i32 (i32*, i8*, ...) @fprintf(i32* %90, i8* getelementptr inbounds ([552 x i8], [552 x i8]* @.str.3, i64 0, i64 0), double %93, double %96, double %99, double %102, double %105, double %108, double %111, double %114, double %117, double %120, double %123, double %126, double %129, double %132, double %135, double %138)
%140 = load i32*, i32** %36
%141 = load double, double* %24
%142 = load double, double* %25
%143 = load i8*, i8** %19
%144 = call i32 (i32*, i8*, ...) @fprintf(i32* %140, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.4, i64 0, i64 0), double %141, double %142, i8* %143)
%145 = load double, double* %20
%146 = fcmp une double %145, 0.000000e+00
br i1 %146, label %147, label %151
147: ; preds = %84
%148 = load i32*, i32** %36
%149 = load double, double* %20
%150 = call i32 (i32*, i8*, ...) @fprintf(i32* %148, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %149)
br label %151
151: ; preds = %147, %84
%152 = load i32*, i32** %36
%153 = call i32 @fclose(i32* %152)
%154 = getelementptr inbounds [100 x i8], [100 x i8]* %37, i64 0, i64 0
%155 = load i8*, i8** %15
%156 = call i32 @sprintf(i8* %154, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %155)
%157 = getelementptr inbounds [100 x i8], [100 x i8]* %37, i64 0, i64 0
%158 = call i32* @fopen(i8* %157, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %158, i32** %36
%159 = load i32*, i32** %36
%160 = load i8*, i8** %17
%161 = load i8*, i8** %18
%162 = getelementptr inbounds [2 x i8], [2 x i8]* %31, i64 0, i64 0
%163 = load double, double* %27
%164 = load double, double* %26
%165 = load double, double* %32
%166 = load double, double* %33
%167 = load double, double* %34
%168 = load double, double* %35
%169 = load i8*, i8** %23
%170 = load i8*, i8** %23
%171 = load double, double* %28
%172 = getelementptr inbounds [2 x i8], [2 x i8]* %29, i64 0, i64 0
%173 = getelementptr inbounds [2 x i8], [2 x i8]* %29, i64 0, i64 0
%174 = load i8*, i8** %22
%175 = getelementptr inbounds [2 x i8], [2 x i8]* %30, i64 0, i64 0
%176 = call i32 (i32*, i8*, ...) @fprintf(i32* %159, i8* getelementptr inbounds ([445 x i8], [445 x i8]* @.str.7, i64 0, i64 0), i8* %160, i8* %161, i8* %162, double %163, double %164, double %165, double %166, double %167, double %168, i8* %169, i8* %170, double %171, i8* %172, i8* %173, i8* %174, i8* %175)
%177 = load i32*, i32** %36
%178 = call i32 @fclose(i32* %177)
%179 = getelementptr inbounds [100 x i8], [100 x i8]* %37, i64 0, i64 0
%180 = load i8*, i8** %15
%181 = call i32 @sprintf(i8* %179, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %180)
%182 = getelementptr inbounds [100 x i8], [100 x i8]* %37, i64 0, i64 0
%183 = call i32* @fopen(i8* %182, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %183, i32** %36
%184 = load i8*, i8** %21
%185 = load i32*, i32** %36
%186 = call i32 @fputs(i8* %184, i32* %185)
%187 = load i32*, i32** %36
%188 = call i32 @fclose(i32* %187)
%189 = getelementptr inbounds [200 x i8], [200 x i8]* %40, i64 0, i64 0
%190 = load i8*, i8** %15
%191 = call i32 @sprintf(i8* %189, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0), i8* %190)
%192 = getelementptr inbounds [200 x i8], [200 x i8]* %40, i64 0, i64 0
%193 = call i32 @system(i8* %192)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"ptpath\00"
@.str.1 = [11 x i8] c"%ssc.melts\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [552 x i8] c"Title: dummy\09\09\09\0AInitial Composition: SiO2 %.4f\09\09\09\0AInitial Composition: TiO2 %.4f\09\09\09\0AInitial Composition: Al2O3 %.4f\09\09\09\0AInitial Composition: Fe2O3 %.4f\09\09\09\0AInitial Composition: Cr2O3 %.4f\09\09\09\0AInitial Composition: FeO %.4f\09\09\09\0AInitial Composition: MnO %.4f\09\09\09\0AInitial Composition: MgO %.4f\09\09\09\0AInitial Composition: NiO %.4f\09\09\09\0AInitial Composition: CoO %.4f\09\09\09\0AInitial Composition: CaO %.4f\09\09\09\0AInitial Composition: Na2O %.4f\09\09\09\0AInitial Composition: K2O %.4f\09\09\09\0AInitial Composition: P2O5 %.4f\09\09\09\0AInitial Composition: CO2 %.4f\09\09\09\0AInitial Composition: H2O %.4f\0A\00"
@.str.4 = [73 x i8] c"Initial Temperature: %.2f\09\09\09\0AInitial Pressure: %.2f\09\09\09\0Alog fo2 Path: %s\0A\00"
@.str.5 = [21 x i8] c"log fo2 Delta: %.2f\0A\00"
@.str.6 = [12 x i8] c"%smelts_env\00"
@.str.7 = [445 x i8] c"\0AALPHAMELTS_VERSION\09\09%s\09\09\09\0AALPHAMELTS_MODE\09\09\09%s\09\09\09\0A%sALPHAMELTS_PTPATH_FILE\09\09ptpath\09\09\09\0AALPHAMELTS_DELTAP\09\09%.0f\09\09\09\0AALPHAMELTS_DELTAT\09\09%.0f\09\09\09\0AALPHAMELTS_MAXP\09\09\09%.0f\09\09\09\0AALPHAMELTS_MINP\09\09\09%.0f\09\09\09\0AALPHAMELTS_MAXT\09\09\09%.0f\09\09\09\0AALPHAMELTS_MINT\09\09\09%.0f\09\09\09\0A%sALPHAMELTS_FRACTIONATE_SOLIDS\09true\09\09\09\0A%sALPHAMELTS_MASSIN\09\09%g\09\09\09\0A%sALPHAMELTS_FRACTIONATE_WATER\09true\09\09\09\0A%sALPHAMELTS_MINW\09\09\090.005\09\09\09\0A%sALPHAMELTS_SAVE_ALL\09\09true\09\09\09\0A%sALPHAMELTS_CELSIUS_OUTPUT\09true\0A\00"
@.str.8 = [8 x i8] c"%sbatch\00"
@.str.9 = [65 x i8] c"cd %s; run_alphamelts_v1.41.pl -f melts_env -b batch > /dev/null\00"
define void @runmelts(i8* %0, double* nocapture %1, i8* %2, i8* %3, i8* %4, double %5, i8* nocapture %6, i8* %7, i8* %8, double %9, double %10, double %11, double %12, double %13) {
%15 = alloca i16
%16 = alloca i16
%17 = alloca i16
%18 = alloca [100 x i8]
%19 = alloca [200 x i8]
%20 = bitcast i16* %15 to i8*
store i16 33, i16* %15
%21 = bitcast i16* %16 to i8*
store i16 0, i16* %16
%22 = bitcast i16* %17 to i8*
store i16 33, i16* %17
%23 = tail call i64 @strcasecmp(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %14
store i8 0, i8* %22
br label %26
26: ; preds = %25, %14
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %18, i64 0, i64 0
%28 = getelementptr inbounds double, double* %1, i64 1
%29 = bitcast double* %1 to <2 x double>*
%30 = load <2 x double>, <2 x double>* %29
%31 = extractelement <2 x double> %30, i64 0
%32 = fadd double %31, 0.000000e+00
%33 = extractelement <2 x double> %30, i64 1
%34 = fadd double %32, %33
%35 = getelementptr inbounds double, double* %1, i64 2
%36 = getelementptr inbounds double, double* %1, i64 3
%37 = bitcast double* %35 to <2 x double>*
%38 = load <2 x double>, <2 x double>* %37
%39 = extractelement <2 x double> %38, i64 0
%40 = fadd double %34, %39
%41 = extractelement <2 x double> %38, i64 1
%42 = fadd double %40, %41
%43 = getelementptr inbounds double, double* %1, i64 4
%44 = getelementptr inbounds double, double* %1, i64 5
%45 = bitcast double* %43 to <2 x double>*
%46 = load <2 x double>, <2 x double>* %45
%47 = extractelement <2 x double> %46, i64 0
%48 = fadd double %42, %47
%49 = extractelement <2 x double> %46, i64 1
%50 = fadd double %48, %49
%51 = getelementptr inbounds double, double* %1, i64 6
%52 = getelementptr inbounds double, double* %1, i64 7
%53 = bitcast double* %51 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = extractelement <2 x double> %54, i64 0
%56 = fadd double %50, %55
%57 = extractelement <2 x double> %54, i64 1
%58 = fadd double %56, %57
%59 = getelementptr inbounds double, double* %1, i64 8
%60 = getelementptr inbounds double, double* %1, i64 9
%61 = bitcast double* %59 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = extractelement <2 x double> %62, i64 0
%64 = fadd double %58, %63
%65 = extractelement <2 x double> %62, i64 1
%66 = fadd double %64, %65
%67 = getelementptr inbounds double, double* %1, i64 10
%68 = getelementptr inbounds double, double* %1, i64 11
%69 = bitcast double* %67 to <2 x double>*
%70 = load <2 x double>, <2 x double>* %69
%71 = extractelement <2 x double> %70, i64 0
%72 = fadd double %66, %71
%73 = extractelement <2 x double> %70, i64 1
%74 = fadd double %72, %73
%75 = getelementptr inbounds double, double* %1, i64 12
%76 = getelementptr inbounds double, double* %1, i64 13
%77 = bitcast double* %75 to <2 x double>*
%78 = load <2 x double>, <2 x double>* %77
%79 = extractelement <2 x double> %78, i64 0
%80 = fadd double %74, %79
%81 = extractelement <2 x double> %78, i64 1
%82 = fadd double %80, %81
%83 = getelementptr inbounds double, double* %1, i64 14
%84 = getelementptr inbounds double, double* %1, i64 15
%85 = bitcast double* %83 to <2 x double>*
%86 = load <2 x double>, <2 x double>* %85
%87 = extractelement <2 x double> %86, i64 0
%88 = fadd double %82, %87
%89 = extractelement <2 x double> %86, i64 1
%90 = fadd double %88, %89
%91 = fmul <2 x double> %30, <double 1.000000e+02, double 1.000000e+02>
%92 = insertelement <2 x double> poison, double %90, i64 0
%93 = shufflevector <2 x double> %92, <2 x double> poison, <2 x i32> zeroinitializer
%94 = fdiv <2 x double> %91, %93
%95 = bitcast double* %1 to <2 x double>*
store <2 x double> %94, <2 x double>* %95
%96 = fmul <2 x double> %38, <double 1.000000e+02, double 1.000000e+02>
%97 = fdiv <2 x double> %96, %93
%98 = bitcast double* %35 to <2 x double>*
store <2 x double> %97, <2 x double>* %98
%99 = fmul <2 x double> %46, <double 1.000000e+02, double 1.000000e+02>
%100 = fdiv <2 x double> %99, %93
%101 = bitcast double* %43 to <2 x double>*
store <2 x double> %100, <2 x double>* %101
%102 = fmul <2 x double> %54, <double 1.000000e+02, double 1.000000e+02>
%103 = fdiv <2 x double> %102, %93
%104 = bitcast double* %51 to <2 x double>*
store <2 x double> %103, <2 x double>* %104
%105 = fmul <2 x double> %62, <double 1.000000e+02, double 1.000000e+02>
%106 = fdiv <2 x double> %105, %93
%107 = bitcast double* %59 to <2 x double>*
store <2 x double> %106, <2 x double>* %107
%108 = fmul <2 x double> %70, <double 1.000000e+02, double 1.000000e+02>
%109 = fdiv <2 x double> %108, %93
%110 = bitcast double* %67 to <2 x double>*
store <2 x double> %109, <2 x double>* %110
%111 = fmul <2 x double> %78, <double 1.000000e+02, double 1.000000e+02>
%112 = fdiv <2 x double> %111, %93
%113 = bitcast double* %75 to <2 x double>*
store <2 x double> %112, <2 x double>* %113
%114 = fmul <2 x double> %86, <double 1.000000e+02, double 1.000000e+02>
%115 = fdiv <2 x double> %114, %93
%116 = bitcast double* %83 to <2 x double>*
store <2 x double> %115, <2 x double>* %116
%117 = call i32 @sprintf(i8* %27, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%118 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%119 = load double, double* %1
%120 = load double, double* %28
%121 = load double, double* %35
%122 = load double, double* %36
%123 = load double, double* %43
%124 = load double, double* %44
%125 = load double, double* %51
%126 = load double, double* %52
%127 = load double, double* %59
%128 = load double, double* %60
%129 = load double, double* %67
%130 = load double, double* %68
%131 = load double, double* %75
%132 = load double, double* %76
%133 = load double, double* %83
%134 = load double, double* %84
%135 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %118, i8* getelementptr inbounds ([552 x i8], [552 x i8]* @.str.3, i64 0, i64 0), double %119, double %120, double %121, double %122, double %123, double %124, double %125, double %126, double %127, double %128, double %129, double %130, double %131, double %132, double %133, double %134)
%136 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %118, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.4, i64 0, i64 0), double %9, double %10, i8* %4)
%137 = fcmp une double %5, 0.000000e+00
br i1 %137, label %138, label %140
138: ; preds = %26
%139 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %118, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), double %5)
br label %140
140: ; preds = %138, %26
%141 = tail call i32 @fclose(i32* %118)
%142 = call i32 @sprintf(i8* %27, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%143 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%144 = call i32 (i32*, i8*, ...) @fprintf(i32* %143, i8* getelementptr inbounds ([445 x i8], [445 x i8]* @.str.7, i64 0, i64 0), i8* %2, i8* %3, i16* %17, double %12, double %11, double 9.000000e+04, double 1.000000e+00, double 3.000000e+03, double 6.000000e+02, i8* %8, i8* %8, double %13, i16* %15, i16* %15, i8* %7, i16* %16)
%145 = call i32 @fclose(i32* %143)
%146 = call i32 @sprintf(i8* %27, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %0)
%147 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%148 = call i32 @fputs(i8* %6, i32* %147)
%149 = call i32 @fclose(i32* %147)
%150 = getelementptr inbounds [200 x i8], [200 x i8]* %19, i64 0, i64 0
%151 = call i32 @sprintf(i8* %150, i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.9, i64 0, i64 0), i8* %0)
%152 = call i32 @system(i8* %150)
ret void
}