#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 */
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ starexit(int);
char *inputtextline(char *string, FILE *infile, char *infilename) {
  char *result;
  do {
    result = fgets(string, 1024, infile);
    if (result == (char *)NULL) {
      printf("  Error:  Unexpected end of file in %s.\n", infilename);
      starexit(1);
    }
    while ((*result != '\0') && (*result != '#') && (*result != '.') &&
           (*result != '+') && (*result != '-') &&
           ((*result < '0') || (*result > '9'))) {
      result++;
    }
  } while ((*result == '#') || (*result == '\0'));
  return result;
}


x86 assembly (clang, -O0):
<inputtextline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    117f <inputtextline+0x4f>
mov    -0x18(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <starexit@plt>
jmp    1184 <inputtextline+0x54>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     1218 <inputtextline+0xe8>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x23,%ecx
mov    %al,-0x21(%rbp)
je     1218 <inputtextline+0xe8>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2e,%ecx
mov    %al,-0x21(%rbp)
je     1218 <inputtextline+0xe8>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2b,%ecx
mov    %al,-0x21(%rbp)
je     1218 <inputtextline+0xe8>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2d,%ecx
mov    %al,-0x21(%rbp)
je     1218 <inputtextline+0xe8>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x30,%ecx
mov    %al,-0x22(%rbp)
jl     1212 <inputtextline+0xe2>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
setg   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1228 <inputtextline+0xf8>
jmp    1239 <inputtextline+0x109>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1184 <inputtextline+0x54>
jmp    123e <inputtextline+0x10e>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x23,%ecx
mov    %al,-0x23(%rbp)
je     1263 <inputtextline+0x133>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x23(%rbp)
mov    -0x23(%rbp),%al
test   $0x1,%al
jne    1144 <inputtextline+0x14>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputtextline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
movabs $0x680000000000,%rbp
movabs $0x800000001,%r12
mov    %r13,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1040 <fgets@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1190 <inputtextline+0x60>
lea    0xe89(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <starexit@plt>
nopl   0x0(%rax)
movzbl (%rbx),%eax
cmp    $0x2e,%rax
ja     11a5 <inputtextline+0x75>
bt     %rax,%rbp
jb     11b1 <inputtextline+0x81>
bt     %rax,%r12
jb     1158 <inputtextline+0x28>
add    $0xc6,%al
cmp    $0xf5,%al
ja     11b1 <inputtextline+0x81>
add    $0x1,%rbx
jmp    1190 <inputtextline+0x60>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c" Error: Unexpected end of file in %s.\0A\00"
define i8* @inputtextline(i8* %0, i32* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
br label %8
8: ; preds = %72, %3
%9 = load i8*, i8** %4
%10 = load i32*, i32** %5
%11 = call i8* @fgets(i8* %9, i32 1024, i32* %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %8
%15 = load i8*, i8** %6
%16 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @starexit(i32 1)
br label %18
18: ; preds = %14, %8
br label %19
19: ; preds = %58, %18
%20 = load i8*, i8** %7
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %56
24: ; preds = %19
%25 = load i8*, i8** %7
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 35
br i1 %28, label %29, label %56
29: ; preds = %24
%30 = load i8*, i8** %7
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 46
br i1 %33, label %34, label %56
34: ; preds = %29
%35 = load i8*, i8** %7
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp ne i32 %37, 43
br i1 %38, label %39, label %56
39: ; preds = %34
%40 = load i8*, i8** %7
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 45
br i1 %43, label %44, label %56
44: ; preds = %39
%45 = load i8*, i8** %7
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp slt i32 %47, 48
br i1 %48, label %54, label %49
49: ; preds = %44
%50 = load i8*, i8** %7
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp sgt i32 %52, 57
br label %54
54: ; preds = %49, %44
%55 = phi i1 [ true, %44 ], [ %53, %49 ]
br label %56
56: ; preds = %54, %39, %34, %29, %24, %19
%57 = phi i1 [ false, %39 ], [ false, %34 ], [ false, %29 ], [ false, %24 ], [ false, %19 ], [ %55, %54 ]
br i1 %57, label %58, label %61
58: ; preds = %56
%59 = load i8*, i8** %7
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %7
br label %19
61: ; preds = %56
br label %62
62: ; preds = %61
%63 = load i8*, i8** %7
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 35
br i1 %66, label %72, label %67
67: ; preds = %62
%68 = load i8*, i8** %7
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 0
br label %72
72: ; preds = %67, %62
%73 = phi i1 [ true, %62 ], [ %71, %67 ]
br i1 %73, label %8, label %74
74: ; preds = %72
%75 = load i8*, i8** %7
ret i8* %75
}

LLVM IR (-O2):
@.str = [41 x i8] c" Error: Unexpected end of file in %s.\0A\00"
define i8* @inputtextline(i8* %0, i32* nocapture %1, i8* %2) {
br label %5
4: ; preds = %12, %12
br label %5
5: ; preds = %4, %3
%6 = tail call i8* @fgets(i8* %0, i32 1024, i32* %1)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %2)
%10 = tail call i32 @starexit(i32 1)
br label %11
11: ; preds = %8, %5
br label %12
12: ; preds = %11, %18
%13 = phi i8* [ %19, %18 ], [ %6, %11 ]
%14 = load i8, i8* %13
switch i8 %14, label %15 [
i8 35, label %4
i8 0, label %4
i8 43, label %20
i8 45, label %20
i8 46, label %20
]
15: ; preds = %12
%16 = add i8 %14, -58
%17 = icmp ult i8 %16, -10
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = getelementptr inbounds i8, i8* %13, i64 1
br label %12
20: ; preds = %12, %12, %12, %15
ret i8* %13
}