#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*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ nrerror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sncndn(float, float, float *, float *, float *);
scalar_t__ strncmp(char *, char *, int);
int main(void) {
  char txt[80];
  int i, nval;
  float em, emmc, uu, val, sn, cn, dn;
  FILE *fp;
  if ((fp = fopen("fncval.dat", "r")) == NULL)
    nrerror("Data file fncval.dat not found\n");
  fgets(txt, 80, fp);
  while (strncmp(txt, "Jacobian Elliptic Function", 26)) {
    fgets(txt, 80, fp);
    if (feof(fp))
      nrerror("Data not found in fncval.dat\n");
  }
  fscanf(fp, "%d %*s", &nval);
  printf("\n%s\n", txt);
  printf("%4s %8s %16s %13s %15s %18s\n", "mc", "u", "actual", "sn",
         "sn^2+cn^2", "(mc)*(sn^2)+dn^2");
  for (i = 1; i <= nval; i++) {
    fscanf(fp, "%f %f %f", &em, &uu, &val);
    emmc = 1.0 - em;
    sncndn(uu, emmc, &sn, &cn, &dn);
    printf("%5.2f %8.2f %15.5f %15.5f %12.5f %14.5f\n", emmc, uu, val, sn,
           (sn * sn + cn * cn), (em * sn * sn + dn * dn));
  }
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe5f(%rip),%rdi
lea    0xe63(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x90(%rbp)
cmp    $0x0,%rax
jne    11d2 <main+0x42>
lea    0xe48(%rip),%rdi
call   1040 <nrerror@plt>
lea    -0x60(%rbp),%rdi
mov    -0x90(%rbp),%rdx
mov    $0x50,%esi
call   1090 <fgets@plt>
lea    -0x60(%rbp),%rdi
lea    0xe43(%rip),%rsi
mov    $0x1a,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1242 <main+0xb2>
lea    -0x60(%rbp),%rdi
mov    -0x90(%rbp),%rdx
mov    $0x50,%esi
call   1090 <fgets@plt>
mov    -0x90(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x0,%rax
je     123d <main+0xad>
lea    0xe18(%rip),%rdi
call   1040 <nrerror@plt>
jmp    11e7 <main+0x57>
mov    -0x90(%rbp),%rdi
lea    0xe1e(%rip),%rsi
lea    -0x68(%rbp),%rdx
mov    $0x0,%al
call   1080 <fscanf@plt>
lea    -0x60(%rbp),%rsi
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe06(%rip),%rdi
lea    0xe1c(%rip),%rsi
lea    0xe18(%rip),%rdx
lea    0xe13(%rip),%rcx
lea    0xe13(%rip),%r8
lea    0xe0f(%rip),%r9
lea    0xe12(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x68(%rbp),%eax
jg     13a4 <main+0x214>
mov    -0x90(%rbp),%rdi
lea    0xdf7(%rip),%rsi
lea    -0x6c(%rbp),%rdx
lea    -0x74(%rbp),%rcx
lea    -0x78(%rbp),%r8
mov    $0x0,%al
call   1080 <fscanf@plt>
movss  -0x6c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd12(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x74(%rbp),%xmm0
movss  -0x70(%rbp),%xmm1
lea    -0x7c(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x84(%rbp),%rdx
call   1070 <sncndn@plt>
movss  -0x70(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x74(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x78(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x7c(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movss  -0x7c(%rbp),%xmm4
movss  -0x7c(%rbp),%xmm6
movss  -0x80(%rbp),%xmm5
mulss  -0x80(%rbp),%xmm5
mulss  %xmm6,%xmm4
addss  %xmm5,%xmm4
cvtss2sd %xmm4,%xmm4
movss  -0x6c(%rbp),%xmm5
mulss  -0x7c(%rbp),%xmm5
movss  -0x7c(%rbp),%xmm7
movss  -0x84(%rbp),%xmm6
ff
mulss  -0x84(%rbp),%xmm6
ff
mulss  %xmm7,%xmm5
addss  %xmm6,%xmm5
cvtss2sd %xmm5,%xmm5
lea    0xd3b(%rip),%rdi
mov    $0x6,%al
call   1060 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    12b0 <main+0x120>
mov    -0x90(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xe5c(%rip),%rdi
lea    0xe60(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11c8 <main+0x38>
lea    0xe4e(%rip),%rdi
call   1040 <nrerror@plt>
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x50,%esi
mov    %rbx,%rdx
call   1090 <fgets@plt>
lea    0xe4d(%rip),%rsi
mov    %rbp,%rdi
mov    $0x1a,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     124c <main+0xbc>
lea    0x30(%rsp),%rbp
lea    0xe2f(%rip),%r14
lea    0xe43(%rip),%r15
jmp    1225 <main+0x95>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x1a,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     124c <main+0xbc>
mov    %rbp,%rdi
mov    $0x50,%esi
mov    %rbx,%rdx
call   1090 <fgets@plt>
mov    %rbx,%rdi
call   10a0 <feof@plt>
test   %rax,%rax
je     1210 <main+0x80>
mov    %r15,%rdi
call   1040 <nrerror@plt>
jmp    1210 <main+0x80>
lea    0xe17(%rip),%rsi
lea    0x18(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <fscanf@plt>
lea    0xe08(%rip),%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe30(%rip),%rax
mov    %rax,(%rsp)
lea    0xdef(%rip),%rdi
lea    0xe05(%rip),%rsi
lea    0xe01(%rip),%rdx
lea    0xdfc(%rip),%rcx
lea    0xdfc(%rip),%r8
lea    0xdf8(%rip),%r9
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x0,0x18(%rsp)
jle    13a5 <main+0x215>
lea    0x28(%rsp),%rbp
lea    0x24(%rsp),%r14
lea    0x20(%rsp),%r15
lea    0xdf4(%rip),%r12
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
lea    0xdd3(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x2c(%rsp),%r8
xor    %eax,%eax
call   1080 <fscanf@plt>
movss  0xcf8(%rip),%xmm1
subss  0x14(%rsp),%xmm1
movss  %xmm1,0x1c(%rsp)
movss  0x10(%rsp),%xmm0
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1070 <sncndn@plt>
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  0x2c(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  0x28(%rsp),%xmm4
xorps  %xmm3,%xmm3
cvtss2sd %xmm4,%xmm3
movss  0x24(%rsp),%xmm5
mulss  %xmm5,%xmm5
movss  0x14(%rsp),%xmm6
mulss  %xmm4,%xmm6
mulss  %xmm4,%xmm6
mulss  %xmm4,%xmm4
addss  %xmm5,%xmm4
cvtss2sd %xmm4,%xmm4
movss  0x20(%rsp),%xmm5
mulss  %xmm5,%xmm5
addss  %xmm5,%xmm6
xorps  %xmm5,%xmm5
cvtss2sd %xmm6,%xmm5
mov    %r12,%rdi
mov    $0x6,%al
call   1060 <printf@plt>
add    $0x1,%r13d
cmp    0x18(%rsp),%r13d
jl     12e0 <main+0x150>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"fncval.dat\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [32 x i8] c"Data file fncval.dat not found\0A\00"
@.str.3 = [27 x i8] c"Jacobian Elliptic Function\00"
@.str.4 = [30 x i8] c"Data not found in fncval.dat\0A\00"
@.str.5 = [7 x i8] c"%d %*s\00"
@.str.6 = [5 x i8] c"\0A%s\0A\00"
@.str.7 = [29 x i8] c"%4s %8s %16s %13s %15s %18s\0A\00"
@.str.8 = [3 x i8] c"mc\00"
@.str.9 = [2 x i8] c"u\00"
@.str.10 = [7 x i8] c"actual\00"
@.str.11 = [3 x i8] c"sn\00"
@.str.12 = [10 x i8] c"sn^2+cn^2\00"
@.str.13 = [17 x i8] c"(mc)*(sn^2)+dn^2\00"
@.str.14 = [9 x i8] c"%f %f %f\00"
@.str.15 = [41 x i8] c"%5.2f %8.2f %15.5f %15.5f %12.5f %14.5f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca i32*
store i32 0, i32* %1
%13 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %13, i32** %12
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @nrerror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %0
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%19 = load i32*, i32** %12
%20 = call i32 @fgets(i8* %18, i32 80, i32* %19)
br label %21
21: ; preds = %34, %17
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%23 = call i64 @strncmp(i8* %22, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 26)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %35
25: ; preds = %21
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%27 = load i32*, i32** %12
%28 = call i32 @fgets(i8* %26, i32 80, i32* %27)
%29 = load i32*, i32** %12
%30 = call i64 @feof(i32* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %25
%33 = call i32 @nrerror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %32, %25
br label %21
35: ; preds = %21
%36 = load i32*, i32** %12
%37 = call i32 (i32*, i8*, ...) @fscanf(i32* %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%38 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %3
br label %41
41: ; preds = %80, %35
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = icmp sle i32 %42, %43
br i1 %44, label %45, label %83
45: ; preds = %41
%46 = load i32*, i32** %12
%47 = call i32 (i32*, i8*, ...) @fscanf(i32* %46, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), float* %5, float* %7, float* %8)
%48 = load float, float* %5
%49 = fpext float %48 to double
%50 = fsub double 1.000000e+00, %49
%51 = fptrunc double %50 to float
store float %51, float* %6
%52 = load float, float* %7
%53 = load float, float* %6
%54 = call i32 @sncndn(float %52, float %53, float* %9, float* %10, float* %11)
%55 = load float, float* %6
%56 = fpext float %55 to double
%57 = load float, float* %7
%58 = fpext float %57 to double
%59 = load float, float* %8
%60 = fpext float %59 to double
%61 = load float, float* %9
%62 = fpext float %61 to double
%63 = load float, float* %9
%64 = load float, float* %9
%65 = load float, float* %10
%66 = load float, float* %10
%67 = fmul float %65, %66
%68 = call float @llvm.fmuladd.f32(float %63, float %64, float %67)
%69 = fpext float %68 to double
%70 = load float, float* %5
%71 = load float, float* %9
%72 = fmul float %70, %71
%73 = load float, float* %9
%74 = load float, float* %11
%75 = load float, float* %11
%76 = fmul float %74, %75
%77 = call float @llvm.fmuladd.f32(float %72, float %73, float %76)
%78 = fpext float %77 to double
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0), double %56, double %58, double %60, double %62, double %69, double %78)
br label %80
80: ; preds = %45
%81 = load i32, i32* %3
%82 = add nsw i32 %81, 1
store i32 %82, i32* %3
br label %41
83: ; preds = %41
%84 = load i32*, i32** %12
%85 = call i32 @fclose(i32* %84)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"fncval.dat\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [32 x i8] c"Data file fncval.dat not found\0A\00"
@.str.3 = [27 x i8] c"Jacobian Elliptic Function\00"
@.str.4 = [30 x i8] c"Data not found in fncval.dat\0A\00"
@.str.5 = [7 x i8] c"%d %*s\00"
@.str.6 = [5 x i8] c"\0A%s\0A\00"
@.str.7 = [29 x i8] c"%4s %8s %16s %13s %15s %18s\0A\00"
@.str.8 = [3 x i8] c"mc\00"
@.str.9 = [2 x i8] c"u\00"
@.str.10 = [7 x i8] c"actual\00"
@.str.11 = [3 x i8] c"sn\00"
@.str.12 = [10 x i8] c"sn^2+cn^2\00"
@.str.13 = [17 x i8] c"(mc)*(sn^2)+dn^2\00"
@.str.14 = [9 x i8] c"%f %f %f\00"
@.str.15 = [41 x i8] c"%5.2f %8.2f %15.5f %15.5f %12.5f %14.5f\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%10 = bitcast i32* %2 to i8*
%11 = bitcast float* %3 to i8*
%12 = bitcast float* %4 to i8*
%13 = bitcast float* %5 to i8*
%14 = bitcast float* %6 to i8*
%15 = bitcast float* %7 to i8*
%16 = bitcast float* %8 to i8*
%17 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %21
19: ; preds = %0
%20 = tail call i32 @nrerror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %0
%22 = call i32 @fgets(i8* %9, i32 80, i32* %17)
%23 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 26)
%24 = icmp eq i64 %23, 0
br i1 %24, label %34, label %25
25: ; preds = %21, %31
%26 = call i32 @fgets(i8* %9, i32 80, i32* %17)
%27 = call i64 @feof(i32* %17)
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = call i32 @nrerror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %25
%32 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 26)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %25
34: ; preds = %31, %21
%35 = call i32 (i32*, i8*, ...) @fscanf(i32* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* %9)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i64 0, i64 0))
%38 = load i32, i32* %2
%39 = icmp slt i32 %38, 1
br i1 %39, label %68, label %40
40: ; preds = %34, %40
%41 = phi i32 [ %65, %40 ], [ 1, %34 ]
%42 = call i32 (i32*, i8*, ...) @fscanf(i32* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), float* %3, float* %4, float* %5)
%43 = load float, float* %3
%44 = fsub float 1.000000e+00, %43
%45 = load float, float* %4
%46 = call i32 @sncndn(float %45, float %44, float* %6, float* %7, float* %8)
%47 = fpext float %44 to double
%48 = load float, float* %4
%49 = fpext float %48 to double
%50 = load float, float* %5
%51 = fpext float %50 to double
%52 = load float, float* %6
%53 = fpext float %52 to double
%54 = load float, float* %7
%55 = fmul float %54, %54
%56 = call float @llvm.fmuladd.f32(float %52, float %52, float %55)
%57 = fpext float %56 to double
%58 = load float, float* %3
%59 = fmul float %52, %58
%60 = load float, float* %8
%61 = fmul float %60, %60
%62 = call float @llvm.fmuladd.f32(float %59, float %52, float %61)
%63 = fpext float %62 to double
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0), double %47, double %49, double %51, double %53, double %57, double %63)
%65 = add nuw nsw i32 %41, 1
%66 = load i32, i32* %2
%67 = icmp slt i32 %41, %66
br i1 %67, label %40, label %68
68: ; preds = %40, %34
%69 = call i32 @fclose(i32* %17)
ret i32 0
}