#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*/ F_OK;
int /*<<< orphan*/ R_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ is_fortran_file(char *);
scalar_t__ is_tex_file(char *);
int /*<<< orphan*/ print_syntax();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ seetex_error(char *, int);
int /*<<< orphan*/ seetex_process(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ strncmp(char *, char *, size_t);
int /*<<< orphan*/ usage(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int i;
  char *file_tex;
  char *file_source;
  FILE *texid;
  FILE *srcid;
  if (0 >= 10) {
    for (i = 0; i < argc; i++)
      (void)printf(" seetex argument: %d  is <%s>\n", i, argv[i]);
    (void)printf("\n");
  }
  if (argc == 1) {
    (void)printf(" zero arguments: print usage/syntax only \n\n");
    (void)print_syntax();
    (void)usage(0);
  }
  for (i = 0; i < argc; i++) {
    if (!strncmp(argv[i], "-h", (size_t)2)) {
      (void)printf(" [-h|-help] flag found: print usage/syntax only\n\n");
      (void)print_syntax();
      (void)usage(0);
    }
  }
  file_tex = argv[(argc - 1)];
  if (0 >= 10)
    (void)printf(" seetex output file <%s>\n\n", file_tex);
  if (is_tex_file(file_tex)) {
    if (access(file_tex, F_OK)) {
      if (0 >= 10)
        (void)printf("Creating %s\n", file_tex);
    } else {
      if (0 >= 10)
        (void)printf("Appending to %s\n", file_tex);
    }
    texid = fopen(file_tex, "a");
  } else
    (void)seetex_error("tex file not specified in proper order", -1);
  for (i = 1; i < (argc - 1); i++) {
    file_source = argv[i];
    if (is_fortran_file(file_source) && (!access(file_source, R_OK))) {
      if (0 >= 10)
        (void)printf("fortran or seetex include file %s is readable\n",
                     file_source);
      srcid = fopen(file_source, "r");
    } else
      (void)seetex_error(
          " fortran source or seetex include file does not exist or \n         "
          "     does not have the proper '.F', '.f', '.fh' suffix",
          -2);
    if (0 >= 10) {
      if (is_fortran_file(file_source))
        (void)printf("%s is a fortran or seetex include file\n", file_source);
      else
        (void)printf("%s is NOT a fortran or seetex include file\n",
                     file_source);
    }
    (void)printf(" tex output from <%s> written to <<%s>>\n", file_source,
                 file_tex);
    if (!seetex_process(srcid, texid))
      (void)seetex_error(
          " error processing fortran source or seetex include file\n", 1);
    (void)fflush(texid);
    (void)fclose(srcid);
  }
  (void)fflush(texid);
  (void)fclose(texid);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11fc <main+0x3c>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1080 <print_syntax@plt>
xor    %edi,%edi
call   10b0 <usage@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1264 <main+0xa4>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe0a(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1251 <main+0x91>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1080 <print_syntax@plt>
xor    %edi,%edi
call   10b0 <usage@plt>
jmp    1256 <main+0x96>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1203 <main+0x43>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <is_tex_file@plt>
cmp    $0x0,%rax
je     12cb <main+0x10b>
mov    -0x20(%rbp),%rdi
mov    0x2d39(%rip),%rax
mov    (%rax),%esi
call   10c0 <access@plt>
cmp    $0x0,%rax
je     12ad <main+0xed>
jmp    12b2 <main+0xf2>
jmp    12b2 <main+0xf2>
mov    -0x20(%rbp),%rdi
lea    0xda4(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x30(%rbp)
jmp    12dc <main+0x11c>
lea    0xd91(%rip),%rdi
mov    $0xffffffff,%esi
call   10a0 <seetex_error@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13ba <main+0x1fa>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1070 <is_fortran_file@plt>
cmp    $0x0,%rax
je     134c <main+0x18c>
mov    -0x28(%rbp),%rdi
mov    0x2cbe(%rip),%rax
mov    (%rax),%esi
call   10c0 <access@plt>
cmp    $0x0,%rax
jne    134c <main+0x18c>
mov    -0x28(%rbp),%rdi
lea    0xd4a(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x38(%rbp)
jmp    135d <main+0x19d>
lea    0xd37(%rip),%rdi
mov    $0xfffffffe,%esi
call   10a0 <seetex_error@plt>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   10d0 <seetex_process@plt>
cmp    $0x0,%eax
jne    139a <main+0x1da>
lea    0xd9d(%rip),%rdi
mov    $0x1,%esi
call   10a0 <seetex_error@plt>
mov    -0x30(%rbp),%rdi
call   1090 <fflush@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12e3 <main+0x123>
mov    -0x30(%rbp),%rdi
call   1090 <fflush@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %edi,%r15d
cmp    $0x1,%edi
jne    1202 <main+0x32>
lea    0xf4c(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1090 <print_syntax@plt>
xor    %edi,%edi
call   10c0 <usage@plt>
jmp    1204 <main+0x34>
jl     1256 <main+0x86>
mov    %r15d,%ebx
lea    0xdf2(%rip),%r13
lea    0xef3(%rip),%r14
xor    %ebp,%ebp
jmp    1229 <main+0x59>
nopl   0x0(%rax)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1256 <main+0x86>
mov    (%r12,%rbp,8),%rdi
mov    $0x2,%edx
mov    %r13,%rsi
call   1030 <strncmp@plt>
test   %eax,%eax
jne    1220 <main+0x50>
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1090 <print_syntax@plt>
xor    %edi,%edi
call   10c0 <usage@plt>
jmp    1220 <main+0x50>
movslq %r15d,%rax
mov    -0x8(%r12,%rax,8),%rbx
mov    %rbx,%rdi
call   1050 <is_tex_file@plt>
test   %rax,%rax
mov    %rbx,(%rsp)
je     129d <main+0xcd>
mov    0x2d5a(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10d0 <access@plt>
lea    0xd7c(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <fopen@plt>
mov    %rax,%rbp
cmp    $0x3,%r15d
jge    12b8 <main+0xe8>
jmp    1380 <main+0x1b0>
lea    0xd61(%rip),%rdi
mov    $0xffffffff,%esi
call   10b0 <seetex_error@plt>
cmp    $0x3,%r15d
jl     1380 <main+0x1b0>
add    $0xffffffff,%r15d
mov    %r15d,%ebx
mov    $0x1,%r14d
jmp    12ed <main+0x11d>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   10a0 <fflush@plt>
mov    %r13,%rdi
call   1060 <fclose@plt>
add    $0x1,%r14
cmp    %r14,%rbx
je     1380 <main+0x1b0>
mov    (%r12,%r14,8),%r15
mov    %r15,%rdi
call   1080 <is_fortran_file@plt>
test   %rax,%rax
je     1314 <main+0x144>
mov    0x2cdb(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
call   10d0 <access@plt>
test   %rax,%rax
je     1330 <main+0x160>
lea    0xd11(%rip),%rdi
mov    $0xfffffffe,%esi
call   10b0 <seetex_error@plt>
jmp    1342 <main+0x172>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
lea    0xcf0(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,%r13
lea    0xd5d(%rip),%rdi
mov    %r15,%rsi
mov    (%rsp),%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
call   10e0 <seetex_process@plt>
test   %eax,%eax
jne    12d0 <main+0x100>
lea    0xd5e(%rip),%rdi
mov    $0x1,%esi
call   10b0 <seetex_error@plt>
jmp    12d0 <main+0x100>
mov    %rbp,%rdi
call   10a0 <fflush@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c" zero arguments: print usage/syntax only \0A\0A\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [50 x i8] c" [-h|-help] flag found: print usage/syntax only\0A\0A\00"
@F_OK = global i32 0
@.str.3 = [2 x i8] c"a\00"
@.str.4 = [39 x i8] c"tex file not specified in proper order\00"
@R_OK = global i32 0
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [122 x i8] c" fortran source or seetex include file does not exist or \0A does not have the proper '.F', '.f', '.fh' suffix\00"
@.str.7 = [41 x i8] c" tex output from <%s> written to <<%s>>\0A\00"
@.str.8 = [57 x i8] c" error processing fortran source or seetex include file\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (...) @print_syntax()
%16 = call i32 @usage(i32 0)
br label %17
17: ; preds = %13, %2
store i32 0, i32* %6
br label %18
18: ; preds = %35, %17
%19 = load i32, i32* %6
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = load i8**, i8*** %5
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 @strncmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2)
%29 = icmp ne i32 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %22
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%32 = call i32 (...) @print_syntax()
%33 = call i32 @usage(i32 0)
br label %34
34: ; preds = %30, %22
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %18
38: ; preds = %18
%39 = load i8**, i8*** %5
%40 = load i32, i32* %4
%41 = sub nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %39, i64 %42
%44 = load i8*, i8** %43
store i8* %44, i8** %7
%45 = load i8*, i8** %7
%46 = call i64 @is_tex_file(i8* %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %58
48: ; preds = %38
%49 = load i8*, i8** %7
%50 = load i32, i32* @F_OK
%51 = call i64 @access(i8* %49, i32 %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %48
br label %55
54: ; preds = %48
br label %55
55: ; preds = %54, %53
%56 = load i8*, i8** %7
%57 = call i32* @fopen(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %57, i32** %9
br label %60
58: ; preds = %38
%59 = call i32 @seetex_error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 -1)
br label %60
60: ; preds = %58, %55
store i32 1, i32* %6
br label %61
61: ; preds = %100, %60
%62 = load i32, i32* %6
%63 = load i32, i32* %4
%64 = sub nsw i32 %63, 1
%65 = icmp slt i32 %62, %64
br i1 %65, label %66, label %103
66: ; preds = %61
%67 = load i8**, i8*** %5
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
%71 = load i8*, i8** %70
store i8* %71, i8** %8
%72 = load i8*, i8** %8
%73 = call i64 @is_fortran_file(i8* %72)
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %83
75: ; preds = %66
%76 = load i8*, i8** %8
%77 = load i32, i32* @R_OK
%78 = call i64 @access(i8* %76, i32 %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %83, label %80
80: ; preds = %75
%81 = load i8*, i8** %8
%82 = call i32* @fopen(i8* %81, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %82, i32** %10
br label %85
83: ; preds = %75, %66
%84 = call i32 @seetex_error(i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str.6, i64 0, i64 0), i32 -2)
br label %85
85: ; preds = %83, %80
%86 = load i8*, i8** %8
%87 = load i8*, i8** %7
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i8* %86, i8* %87)
%89 = load i32*, i32** %10
%90 = load i32*, i32** %9
%91 = call i32 @seetex_process(i32* %89, i32* %90)
%92 = icmp ne i32 %91, 0
br i1 %92, label %95, label %93
93: ; preds = %85
%94 = call i32 @seetex_error(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), i32 1)
br label %95
95: ; preds = %93, %85
%96 = load i32*, i32** %9
%97 = call i32 @fflush(i32* %96)
%98 = load i32*, i32** %10
%99 = call i32 @fclose(i32* %98)
br label %100
100: ; preds = %95
%101 = load i32, i32* %6
%102 = add nsw i32 %101, 1
store i32 %102, i32* %6
br label %61
103: ; preds = %61
%104 = load i32*, i32** %9
%105 = call i32 @fflush(i32* %104)
%106 = load i32*, i32** %9
%107 = call i32 @fclose(i32* %106)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"-h\00"
@F_OK = global i32 0
@.str.3 = [2 x i8] c"a\00"
@.str.4 = [39 x i8] c"tex file not specified in proper order\00"
@R_OK = global i32 0
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [122 x i8] c" fortran source or seetex include file does not exist or \0A does not have the proper '.F', '.f', '.fh' suffix\00"
@.str.7 = [41 x i8] c" tex output from <%s> written to <<%s>>\0A\00"
@.str.8 = [57 x i8] c" error processing fortran source or seetex include file\0A\00"
@str = [49 x i8] c" [-h|-help] flag found: print usage/syntax only\0A\00"
@str.9 = [43 x i8] c" zero arguments: print usage/syntax only \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 (...) @print_syntax()
%7 = tail call i32 @usage(i32 0)
br label %10
8: ; preds = %2
%9 = icmp sgt i32 %0, 0
br i1 %9, label %10, label %25
10: ; preds = %4, %8
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %10, %22
%13 = phi i64 [ 0, %10 ], [ %23, %22 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = tail call i32 @strncmp(i8* dereferenceable(1) %15, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %12
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%20 = tail call i32 (...) @print_syntax()
%21 = tail call i32 @usage(i32 0)
br label %22
22: ; preds = %12, %18
%23 = add nuw nsw i64 %13, 1
%24 = icmp eq i64 %23, %11
br i1 %24, label %25, label %12
25: ; preds = %22, %8
%26 = add nsw i32 %0, -1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %1, i64 %27
%29 = load i8*, i8** %28
%30 = tail call i64 @is_tex_file(i8* %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %36, label %32
32: ; preds = %25
%33 = load i32, i32* @F_OK
%34 = tail call i64 @access(i8* %29, i32 %33)
%35 = tail call i32* @fopen(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %38
36: ; preds = %25
%37 = tail call i32 @seetex_error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 -1)
br label %38
38: ; preds = %36, %32
%39 = phi i32* [ %35, %32 ], [ undef, %36 ]
%40 = icmp sgt i32 %0, 2
br i1 %40, label %41, label %70
41: ; preds = %38
%42 = zext i32 %26 to i64
br label %43
43: ; preds = %41, %65
%44 = phi i64 [ 1, %41 ], [ %68, %65 ]
%45 = phi i32* [ undef, %41 ], [ %59, %65 ]
%46 = getelementptr inbounds i8*, i8** %1, i64 %44
%47 = load i8*, i8** %46
%48 = tail call i64 @is_fortran_file(i8* %47)
%49 = icmp eq i64 %48, 0
br i1 %49, label %56, label %50
50: ; preds = %43
%51 = load i32, i32* @R_OK
%52 = tail call i64 @access(i8* %47, i32 %51)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = tail call i32* @fopen(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %58
56: ; preds = %50, %43
%57 = tail call i32 @seetex_error(i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str.6, i64 0, i64 0), i32 -2)
br label %58
58: ; preds = %56, %54
%59 = phi i32* [ %45, %56 ], [ %55, %54 ]
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i8* %47, i8* %29)
%61 = tail call i32 @seetex_process(i32* %59, i32* %39)
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = tail call i32 @seetex_error(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), i32 1)
br label %65
65: ; preds = %63, %58
%66 = tail call i32 @fflush(i32* %39)
%67 = tail call i32 @fclose(i32* %59)
%68 = add nuw nsw i64 %44, 1
%69 = icmp eq i64 %68, %42
br i1 %69, label %70, label %43
70: ; preds = %65, %38
%71 = tail call i32 @fflush(i32* %39)
%72 = tail call i32 @fclose(i32* %39)
ret i32 0
}