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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int const atoi(char const *);
char *ctime(int /*<<< orphan*/ const *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ memcmp(char *, char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, int *, int *, char *, char *);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int tolower(char const);
int main(const int argc, const char **argv) {
  char buff[100];
  const char *input_filename = (argc == 1 ? "GGM03C.txt" : argv[1]);
  FILE *ifile = fopen(input_filename, "rb");
  const int max_l = (argc < 3 ? 360 : atoi(argv[2]));
  const time_t t0 = time(NULL);
  size_t i;
  if (!ifile) {
    fprintf(stderr, "%s not opened", input_filename);
    perror("");
    fprintf(
        stderr,
        "This program reads an input .gfc file and outputs the coefficients\n"
        "in a convenient C array.  Run ./gfc_xvt (filename) (max "
        "coefficient).\n");
    return (-1);
  }
  printf("/* Generated from input file %s at %.24s using gfc_xvt */\n",
         input_filename, ctime(&t0));
  printf("#define N_TERMS %d\n\n", max_l);
  printf("   const double ");
  for (i = 0; argv[1][i] && argv[1][i] != '.'; i++)
    printf("%c", tolower(argv[1][i]));
  printf("_terms[] = {\n");
  printf(
      "      /*       C term                    S term                 L M */");
  while (fgets(buff, sizeof(buff), ifile))
    if (!memcmp(buff, "gfc ", 4) && atoi(buff + 3) <= max_l) {
      int l, m, n_scanned;
      char c_term[40], s_term[40];
      char *tptr;
      n_scanned = sscanf(buff + 4, "%d %d %40s %40s", &l, &m, c_term, s_term);
      assert(n_scanned == 4);
      if ((tptr = strchr(c_term, 'D')) != NULL)
        *tptr = 'E';
      if ((tptr = strchr(s_term, 'D')) != NULL)
        *tptr = 'E';
      if (m == 0)
        printf((l < 3) ? "\n" : "#if( N_TERMS >= %d)\n", l);
      printf("     %c %24s, %24s%c   /\x2a %d %d \x2a/\n",
             ((m == 0 && l >= 3) ? ',' : ' '), c_term, s_term,
             ((m == l && l >= 3 - 1) ? ' ' : ','), l, m);
      if (m == l && l >= 3)
        printf("#endif\n");
    }
  printf("};\n");
  fclose(ifile);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1216 <main+0x36>
lea    0xdf6(%rip),%rax
mov    %rax,-0x120(%rbp)
jmp    1225 <main+0x45>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x90(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1267 <main+0x87>
mov    $0x168,%eax
mov    %eax,-0x124(%rbp)
jmp    127a <main+0x9a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1100 <atoi@plt>
mov    %eax,-0x124(%rbp)
mov    -0x124(%rbp),%eax
mov    %eax,-0x94(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,-0x98(%rbp)
cmpq   $0x0,-0x90(%rbp)
jne    12f0 <main+0x110>
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
mov    -0x88(%rbp),%rdx
lea    0xd54(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
lea    0xe2d(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2d0c(%rip),%rax
mov    (%rax),%edi
lea    0xd3f(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1658 <main+0x478>
mov    -0x88(%rbp),%rax
mov    %rax,-0x130(%rbp)
lea    -0x98(%rbp),%rdi
call   1040 <ctime@plt>
mov    -0x130(%rbp),%rsi
mov    %rax,%rdx
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x94(%rbp),%esi
lea    0xdb2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movq   $0x0,-0xa0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0xa0(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x131(%rbp)
je     1392 <main+0x1b2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0xa0(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
setne  %al
mov    %al,-0x131(%rbp)
mov    -0x131(%rbp),%al
test   $0x1,%al
jne    13a5 <main+0x1c5>
jmp    13e4 <main+0x204>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0xa0(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   10c0 <tolower@plt>
mov    %eax,%esi
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xa0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa0(%rbp)
jmp    134f <main+0x16f>
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x90(%rbp),%rdx
mov    $0x64,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1637 <main+0x457>
lea    -0x80(%rbp),%rdi
lea    0xd35(%rip),%rsi
mov    $0x4,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%eax
jne    1632 <main+0x452>
lea    -0x80(%rbp),%rdi
add    $0x3,%rdi
call   1100 <atoi@plt>
cmp    -0x94(%rbp),%eax
jg     1632 <main+0x452>
lea    -0x80(%rbp),%rdi
add    $0x4,%rdi
lea    -0xe0(%rbp),%r8
lea    -0x110(%rbp),%r9
lea    0xcf1(%rip),%rsi
lea    -0xa4(%rbp),%rdx
lea    -0xa8(%rbp),%rcx
call   10d0 <sscanf@plt>
mov    %eax,-0xac(%rbp)
cmpl   $0x4,-0xac(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0xe0(%rbp),%rdi
mov    $0x44,%esi
call   1050 <strchr@plt>
mov    %rax,-0x118(%rbp)
cmp    $0x0,%rax
je     14cc <main+0x2ec>
mov    -0x118(%rbp),%rax
movb   $0x45,(%rax)
lea    -0x110(%rbp),%rdi
mov    $0x44,%esi
call   1050 <strchr@plt>
mov    %rax,-0x118(%rbp)
cmp    $0x0,%rax
je     14f8 <main+0x318>
mov    -0x118(%rbp),%rax
movb   $0x45,(%rax)
cmpl   $0x0,-0xa8(%rbp)
jne    152d <main+0x34d>
mov    -0xa4(%rbp),%ecx
lea    0xc62(%rip),%rdi
lea    0xbdb(%rip),%rax
cmp    $0x3,%ecx
cmovl  %rax,%rdi
mov    -0xa4(%rbp),%esi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
cmpl   $0x0,-0xa8(%rbp)
mov    %al,-0x132(%rbp)
jne    1552 <main+0x372>
cmpl   $0x3,-0xa4(%rbp)
setge  %al
mov    %al,-0x132(%rbp)
mov    -0x132(%rbp),%dl
mov    $0x20,%eax
mov    $0x2c,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0x14c(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0x148(%rbp)
lea    -0x110(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    -0xa8(%rbp),%ecx
xor    %eax,%eax
cmp    -0xa4(%rbp),%ecx
mov    %al,-0x133(%rbp)
jne    15b4 <main+0x3d4>
cmpl   $0x2,-0xa4(%rbp)
setge  %al
mov    %al,-0x133(%rbp)
mov    -0x140(%rbp),%rcx
mov    -0x148(%rbp),%rdx
mov    -0x14c(%rbp),%esi
mov    -0x133(%rbp),%dil
mov    $0x2c,%r8d
mov    $0x20,%eax
test   $0x1,%dil
cmovne %eax,%r8d
mov    -0xa4(%rbp),%r9d
mov    -0xa8(%rbp),%eax
lea    0xb93(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xa8(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jne    162d <main+0x44d>
cmpl   $0x3,-0xa4(%rbp)
jl     162d <main+0x44d>
lea    0xb87(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1632 <main+0x452>
jmp    1400 <main+0x220>
lea    0xb77(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x90(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %rsi,%rbp
cmp    $0x1,%edi
jne    1239 <main+0x39>
lea    0xde0(%rip),%r14
lea    0xde4(%rip),%rsi
mov    %r14,%rdi
call   1100 <fopen@plt>
mov    %rax,%r13
mov    $0x168,%ebx
jmp    1268 <main+0x68>
mov    %edi,%r15d
mov    0x8(%rbp),%r14
lea    0xdc4(%rip),%rsi
mov    %r14,%rdi
call   1100 <fopen@plt>
mov    %rax,%r13
mov    $0x168,%ebx
cmp    $0x3,%r15d
jl     1268 <main+0x68>
mov    0x10(%rbp),%rdi
call   1120 <atoi@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   10d0 <time@plt>
mov    %eax,0x1c(%rsp)
test   %r13,%r13
je     14ac <main+0x2ac>
lea    0x1c(%rsp),%rdi
call   1060 <ctime@plt>
lea    0xe19(%rip),%rdi
mov    %ebx,%r15d
xor    %ebx,%ebx
mov    %r14,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe3b(%rip),%rdi
mov    %r15d,%r14d
mov    %r15d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe3c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x8(%rbp),%rax
movzbl (%rax,%rbx,1),%eax
test   %al,%al
je     12f5 <main+0xf5>
cmp    $0x2e,%al
je     12f5 <main+0xf5>
movsbl %al,%edi
call   10e0 <tolower@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
jmp    12d0 <main+0xd0>
lea    0xea0(%rip),%rdi
call   1040 <puts@plt>
lea    0xdff(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x20(%rsp),%rdi
mov    $0x64,%esi
mov    %r13,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     1484 <main+0x284>
mov    %r14d,%ebx
lea    0xe1a(%rip),%rbp
lea    0x20(%rsp),%r14
lea    0xc0(%rsp),%r12
lea    0x90(%rsp),%r15
jmp    1369 <main+0x169>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x64,%esi
mov    %r13,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     1484 <main+0x284>
mov    %r14,%rdi
mov    %rbp,%rsi
mov    $0x4,%edx
call   1090 <memcmp@plt>
test   %eax,%eax
jne    1350 <main+0x150>
lea    0x23(%rsp),%rdi
call   1120 <atoi@plt>
cmp    %ebx,%eax
jg     1350 <main+0x150>
lea    0x24(%rsp),%rdi
lea    0xdbc(%rip),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
mov    %r12,%r8
mov    %r15,%r9
call   10f0 <sscanf@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   10b0 <assert@plt>
mov    %r12,%rdi
mov    $0x44,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     13cf <main+0x1cf>
movb   $0x45,(%rax)
mov    %r15,%rdi
mov    $0x44,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     13e4 <main+0x1e4>
movb   $0x45,(%rax)
mov    0x14(%rsp),%eax
test   %eax,%eax
jne    1410 <main+0x210>
mov    0x18(%rsp),%esi
cmp    $0x3,%esi
lea    0xd69(%rip),%rdi
lea    0xcf3(%rip),%rax
cmovl  %rax,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x14(%rsp),%eax
mov    0x18(%rsp),%r9d
cmp    $0x3,%r9d
mov    $0x20,%esi
mov    $0x2c,%ecx
cmovge %ecx,%esi
test   %eax,%eax
mov    $0x20,%edx
cmovne %edx,%esi
cmp    $0x2,%r9d
mov    $0x2c,%r8d
cmovge %edx,%r8d
cmp    %r9d,%eax
cmovne %ecx,%r8d
mov    %eax,(%rsp)
lea    0xd29(%rip),%rdi
mov    %r12,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x18(%rsp),%eax
cmp    %eax,0x14(%rsp)
jne    1350 <main+0x150>
cmp    $0x3,%eax
jl     1350 <main+0x150>
lea    0xd32(%rip),%rdi
call   1040 <puts@plt>
jmp    1350 <main+0x150>
lea    0xd1e(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b2d(%rip),%rbx
mov    (%rbx),%edi
lea    0xb52(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
lea    0xc28(%rip),%rdi
call   1110 <perror@plt>
mov    (%rbx),%edi
lea    0xb41(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    149a <main+0x29a>

LLVM IR (-O0):
@.str = [11 x i8] c"GGM03C.txt\00"
@.str.1 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.2 = [14 x i8] c"%s not opened\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [138 x i8] c"This program reads an input .gfc file and outputs the coefficients\0Ain a convenient C array. Run ./gfc_xvt (filename) (max coefficient).\0A\00"
@.str.5 = [59 x i8] c"/* Generated from input file %s at %.24s using gfc_xvt */\0A\00"
@.str.6 = [21 x i8] c"#define N_TERMS %d\0A\0A\00"
@.str.7 = [17 x i8] c" const double \00"
@.str.8 = [3 x i8] c"%c\00"
@.str.9 = [14 x i8] c"_terms[] = {\0A\00"
@.str.10 = [71 x i8] c" /* C term S term L M */\00"
@.str.11 = [5 x i8] c"gfc \00"
@.str.12 = [16 x i8] c"%d %d %40s %40s\00"
@.str.13 = [2 x i8] c"\0A\00"
@.str.14 = [21 x i8] c"#if( N_TERMS >= %d)\0A\00"
@.str.15 = [36 x i8] c" %c %24s, %24s%c /* %d %d */\0A\00"
@.str.16 = [8 x i8] c"#endif\0A\00"
@.str.17 = [4 x i8] c"};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca [40 x i8]
%16 = alloca [40 x i8]
%17 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %21
20: ; preds = %2
br label %25
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
br label %25
25: ; preds = %21, %20
%26 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %20 ], [ %24, %21 ]
store i8* %26, i8** %7
%27 = load i8*, i8** %7
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %28, i32** %8
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 3
br i1 %30, label %31, label %32
31: ; preds = %25
br label %37
32: ; preds = %25
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i32 @atoi(i8* %35)
br label %37
37: ; preds = %32, %31
%38 = phi i32 [ 360, %31 ], [ %36, %32 ]
store i32 %38, i32* %9
%39 = call i32 @time(i32* null)
store i32 %39, i32* %10
%40 = load i32*, i32** %8
%41 = icmp ne i32* %40, null
br i1 %41, label %49, label %42
42: ; preds = %37
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %7
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %44)
%46 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %176
49: ; preds = %37
%50 = load i8*, i8** %7
%51 = call i8* @ctime(i32* %10)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0), i8* %50, i8* %51)
%53 = load i32, i32* %9
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %53)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
store i64 0, i64* %11
br label %56
56: ; preds = %85, %49
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = load i8*, i8** %58
%60 = load i64, i64* %11
%61 = getelementptr inbounds i8, i8* %59, i64 %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %74
65: ; preds = %56
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 1
%68 = load i8*, i8** %67
%69 = load i64, i64* %11
%70 = getelementptr inbounds i8, i8* %68, i64 %69
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp ne i32 %72, 46
br label %74
74: ; preds = %65, %56
%75 = phi i1 [ false, %56 ], [ %73, %65 ]
br i1 %75, label %76, label %88
76: ; preds = %74
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 1
%79 = load i8*, i8** %78
%80 = load i64, i64* %11
%81 = getelementptr inbounds i8, i8* %79, i64 %80
%82 = load i8, i8* %81
%83 = call i32 @tolower(i8 signext %82)
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 %83)
br label %85
85: ; preds = %76
%86 = load i64, i64* %11
%87 = add i64 %86, 1
store i64 %87, i64* %11
br label %56
88: ; preds = %74
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.10, i64 0, i64 0))
br label %91
91: ; preds = %171, %88
%92 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%93 = load i32*, i32** %8
%94 = call i64 @fgets(i8* %92, i32 100, i32* %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %172
96: ; preds = %91
%97 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%98 = call i32 @memcmp(i8* %97, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 4)
%99 = icmp ne i32 %98, 0
br i1 %99, label %171, label %100
100: ; preds = %96
%101 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%102 = getelementptr inbounds i8, i8* %101, i64 3
%103 = call i32 @atoi(i8* %102)
%104 = load i32, i32* %9
%105 = icmp sle i32 %103, %104
br i1 %105, label %106, label %171
106: ; preds = %100
%107 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%108 = getelementptr inbounds i8, i8* %107, i64 4
%109 = getelementptr inbounds [40 x i8], [40 x i8]* %15, i64 0, i64 0
%110 = getelementptr inbounds [40 x i8], [40 x i8]* %16, i64 0, i64 0
%111 = call i32 @sscanf(i8* %108, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32* %12, i32* %13, i8* %109, i8* %110)
store i32 %111, i32* %14
%112 = load i32, i32* %14
%113 = icmp eq i32 %112, 4
%114 = zext i1 %113 to i32
%115 = call i32 @assert(i32 %114)
%116 = getelementptr inbounds [40 x i8], [40 x i8]* %15, i64 0, i64 0
%117 = call i8* @strchr(i8* %116, i8 signext 68)
store i8* %117, i8** %17
%118 = icmp ne i8* %117, null
br i1 %118, label %119, label %121
119: ; preds = %106
%120 = load i8*, i8** %17
store i8 69, i8* %120
br label %121
121: ; preds = %119, %106
%122 = getelementptr inbounds [40 x i8], [40 x i8]* %16, i64 0, i64 0
%123 = call i8* @strchr(i8* %122, i8 signext 68)
store i8* %123, i8** %17
%124 = icmp ne i8* %123, null
br i1 %124, label %125, label %127
125: ; preds = %121
%126 = load i8*, i8** %17
store i8 69, i8* %126
br label %127
127: ; preds = %125, %121
%128 = load i32, i32* %13
%129 = icmp eq i32 %128, 0
br i1 %129, label %130, label %137
130: ; preds = %127
%131 = load i32, i32* %12
%132 = icmp slt i32 %131, 3
%133 = zext i1 %132 to i64
%134 = select i1 %132, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0)
%135 = load i32, i32* %12
%136 = call i32 (i8*, ...) @printf(i8* %134, i32 %135)
br label %137
137: ; preds = %130, %127
%138 = load i32, i32* %13
%139 = icmp eq i32 %138, 0
br i1 %139, label %140, label %143
140: ; preds = %137
%141 = load i32, i32* %12
%142 = icmp sge i32 %141, 3
br label %143
143: ; preds = %140, %137
%144 = phi i1 [ false, %137 ], [ %142, %140 ]
%145 = zext i1 %144 to i64
%146 = select i1 %144, i32 44, i32 32
%147 = getelementptr inbounds [40 x i8], [40 x i8]* %15, i64 0, i64 0
%148 = getelementptr inbounds [40 x i8], [40 x i8]* %16, i64 0, i64 0
%149 = load i32, i32* %13
%150 = load i32, i32* %12
%151 = icmp eq i32 %149, %150
br i1 %151, label %152, label %155
152: ; preds = %143
%153 = load i32, i32* %12
%154 = icmp sge i32 %153, 2
br label %155
155: ; preds = %152, %143
%156 = phi i1 [ false, %143 ], [ %154, %152 ]
%157 = zext i1 %156 to i64
%158 = select i1 %156, i32 32, i32 44
%159 = load i32, i32* %12
%160 = load i32, i32* %13
%161 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.15, i64 0, i64 0), i32 %146, i8* %147, i8* %148, i32 %158, i32 %159, i32 %160)
%162 = load i32, i32* %13
%163 = load i32, i32* %12
%164 = icmp eq i32 %162, %163
br i1 %164, label %165, label %170
165: ; preds = %155
%166 = load i32, i32* %12
%167 = icmp sge i32 %166, 3
br i1 %167, label %168, label %170
168: ; preds = %165
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0))
br label %170
170: ; preds = %168, %165, %155
br label %171
171: ; preds = %170, %100, %96
br label %91
172: ; preds = %91
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
%174 = load i32*, i32** %8
%175 = call i32 @fclose(i32* %174)
store i32 0, i32* %3
br label %176
176: ; preds = %172, %42
%177 = load i32, i32* %3
ret i32 %177
}

LLVM IR (-O2):
@.str = [11 x i8] c"GGM03C.txt\00"
@.str.1 = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.2 = [14 x i8] c"%s not opened\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [138 x i8] c"This program reads an input .gfc file and outputs the coefficients\0Ain a convenient C array. Run ./gfc_xvt (filename) (max coefficient).\0A\00"
@.str.5 = [59 x i8] c"/* Generated from input file %s at %.24s using gfc_xvt */\0A\00"
@.str.6 = [21 x i8] c"#define N_TERMS %d\0A\0A\00"
@.str.7 = [17 x i8] c" const double \00"
@.str.10 = [71 x i8] c" /* C term S term L M */\00"
@.str.11 = [5 x i8] c"gfc \00"
@.str.12 = [16 x i8] c"%d %d %40s %40s\00"
@.str.13 = [2 x i8] c"\0A\00"
@.str.14 = [21 x i8] c"#if( N_TERMS >= %d)\0A\00"
@.str.15 = [36 x i8] c" %c %24s, %24s%c /* %d %d */\0A\00"
@str = [13 x i8] c"_terms[] = {\00"
@str.18 = [3 x i8] c"};\00"
@str.19 = [7 x i8] c"#endif\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [40 x i8]
%8 = alloca [40 x i8]
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = icmp eq i32 %0, 1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %22
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp slt i32 %0, 3
br i1 %17, label %22, label %18
18: ; preds = %13
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
br label %22
22: ; preds = %11, %13, %18
%23 = phi i32* [ %16, %18 ], [ %16, %13 ], [ %12, %11 ]
%24 = phi i8* [ %15, %18 ], [ %15, %13 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %11 ]
%25 = phi i32 [ %21, %18 ], [ 360, %13 ], [ 360, %11 ]
%26 = bitcast i32* %4 to i8*
%27 = tail call i32 @time(i32* null)
store i32 %27, i32* %4
%28 = icmp eq i32* %23, null
br i1 %28, label %29, label %35
29: ; preds = %22
%30 = load i32, i32* @stderr
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%32 = tail call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.4, i64 0, i64 0))
br label %115
35: ; preds = %22
%36 = call i8* @ctime(i32* %4)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.5, i64 0, i64 0), i8* %24, i8* %36)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %25)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%40 = getelementptr inbounds i8*, i8** %1, i64 1
br label %41
41: ; preds = %46, %35
%42 = phi i64 [ 0, %35 ], [ %49, %46 ]
%43 = load i8*, i8** %40
%44 = getelementptr inbounds i8, i8* %43, i64 %42
%45 = load i8, i8* %44
switch i8 %45, label %46 [
i8 0, label %50
i8 46, label %50
]
46: ; preds = %41
%47 = call i32 @tolower(i8 signext %45)
%48 = call i32 @putchar(i32 %47)
%49 = add i64 %42, 1
br label %41
50: ; preds = %41, %41
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str.10, i64 0, i64 0))
%53 = call i64 @fgets(i8* %9, i32 100, i32* %23)
%54 = icmp eq i64 %53, 0
br i1 %54, label %112, label %55
55: ; preds = %50
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 3
%57 = bitcast i32* %5 to i8*
%58 = bitcast i32* %6 to i8*
%59 = getelementptr inbounds [40 x i8], [40 x i8]* %7, i64 0, i64 0
%60 = getelementptr inbounds [40 x i8], [40 x i8]* %8, i64 0, i64 0
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 4
br label %62
62: ; preds = %55, %109
%63 = call i32 @memcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i32 4)
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %109
65: ; preds = %62
%66 = call i32 @atoi(i8* %56)
%67 = icmp sgt i32 %66, %25
br i1 %67, label %109, label %68
68: ; preds = %65
%69 = call i32 @sscanf(i8* %61, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i32* %5, i32* %6, i8* %59, i8* %60)
%70 = icmp eq i32 %69, 4
%71 = zext i1 %70 to i32
%72 = call i32 @assert(i32 %71)
%73 = call i8* @strchr(i8* %59, i8 signext 68)
%74 = icmp eq i8* %73, null
br i1 %74, label %76, label %75
75: ; preds = %68
store i8 69, i8* %73
br label %76
76: ; preds = %75, %68
%77 = call i8* @strchr(i8* %60, i8 signext 68)
%78 = icmp eq i8* %77, null
br i1 %78, label %80, label %79
79: ; preds = %76
store i8 69, i8* %77
br label %80
80: ; preds = %79, %76
%81 = load i32, i32* %6
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %89
83: ; preds = %80
%84 = load i32, i32* %5
%85 = icmp slt i32 %84, 3
%86 = select i1 %85, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0)
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %86, i32 %84)
%88 = load i32, i32* %6
br label %89
89: ; preds = %83, %80
%90 = phi i32 [ %88, %83 ], [ %81, %80 ]
%91 = icmp eq i32 %90, 0
%92 = load i32, i32* %5
%93 = icmp sgt i32 %92, 2
%94 = and i1 %91, %93
%95 = select i1 %94, i32 44, i32 32
%96 = icmp eq i32 %90, %92
%97 = icmp sgt i32 %92, 1
%98 = and i1 %96, %97
%99 = select i1 %98, i32 32, i32 44
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.15, i64 0, i64 0), i32 %95, i8* %59, i8* %60, i32 %99, i32 %92, i32 %90)
%101 = load i32, i32* %6
%102 = load i32, i32* %5
%103 = icmp eq i32 %101, %102
%104 = icmp sgt i32 %102, 2
%105 = and i1 %103, %104
br i1 %105, label %106, label %108
106: ; preds = %89
%107 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.19, i64 0, i64 0))
br label %108
108: ; preds = %106, %89
br label %109
109: ; preds = %108, %65, %62
%110 = call i64 @fgets(i8* %9, i32 100, i32* %23)
%111 = icmp eq i64 %110, 0
br i1 %111, label %112, label %62
112: ; preds = %109, %50
%113 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.18, i64 0, i64 0))
%114 = call i32 @fclose(i32* %23)
br label %115
115: ; preds = %112, %29
%116 = phi i32 [ 0, %112 ], [ -1, %29 ]
ret i32 %116
}