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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
scalar_t__ isalpha(char);
int /*<<< orphan*/ strncmp(char *, char *, int);
char *strtok(char *, char *);
void body(FILE *ifp, FILE *ofp) {
  char line[10000];
  char *space = " ";
  char *p;
  while (fgets(line, sizeof(line), ifp) != NULL) {
    if (!strncmp(line, "====", 4)) {
      p = strtok(line, space);
      if (p) {
        p = strtok(NULL, space);
        if (p) {
          if (isalpha(*p))
            fprintf(ofp, "extern char *%s[];\n", p);
          else {
            fprintf(ofp, "Error: help input line\n  %s\nis bad\n", line);
            exit(-1);
          }
        } else {
          fprintf(ofp,
                  "Error: help input\n  %scontains ==== without following "
                  "helpname\n",
                  line);
          exit(-1);
        }
      } else {
        fprintf(
            ofp,
            "Error: help input\n  %scontains ==== without following space\n",
            line);
        exit(-1);
      }
    }
  }
}


x86 assembly (clang, -O0):
<body>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2730,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe86(%rip),%rax
mov    %rax,-0x2728(%rbp)
lea    -0x2720(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x2710,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     12ba <body+0x15a>
lea    -0x2720(%rbp),%rdi
lea    0xe54(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    12b5 <body+0x155>
lea    -0x2720(%rbp),%rdi
mov    -0x2728(%rbp),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x2730(%rbp)
cmpq   $0x0,-0x2730(%rbp)
je     128f <body+0x12f>
mov    -0x2728(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1070 <strtok@plt>
mov    %rax,-0x2730(%rbp)
cmpq   $0x0,-0x2730(%rbp)
je     1269 <body+0x109>
mov    -0x2730(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     1243 <body+0xe3>
mov    -0x10(%rbp),%rdi
mov    -0x2730(%rbp),%rdx
lea    0xdce(%rip),%rsi
call   1050 <fprintf@plt>
jmp    1264 <body+0x104>
mov    -0x10(%rbp),%rdi
lea    -0x2720(%rbp),%rdx
lea    0xdc6(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
jmp    128a <body+0x12a>
mov    -0x10(%rbp),%rdi
lea    -0x2720(%rbp),%rdx
lea    0xdc4(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
jmp    12b0 <body+0x150>
mov    -0x10(%rbp),%rdi
lea    -0x2720(%rbp),%rdx
lea    0xdde(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
jmp    12b5 <body+0x155>
jmp    1181 <body+0x21>
add    $0x2730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<body>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2718,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
mov    %rsp,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1223 <body+0xc3>
lea    0xe6b(%rip),%r15
mov    %rsp,%rbx
lea    0xe5f(%rip),%r13
jmp    11d7 <body+0x77>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
lea    0xe4d(%rip),%rsi
mov    %rbp,%rdx
call   1050 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %r12,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1223 <body+0xc3>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    11c2 <body+0x62>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <strtok@plt>
test   %rax,%rax
je     1235 <body+0xd5>
xor    %edi,%edi
mov    %r13,%rsi
call   1070 <strtok@plt>
test   %rax,%rax
je     123e <body+0xde>
mov    %rax,%rbp
movsbl (%rax),%edi
call   1060 <isalpha@plt>
test   %rax,%rax
jne    11b0 <body+0x50>
lea    0xdfa(%rip),%rsi
jmp    1245 <body+0xe5>
add    $0x2718,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe43(%rip),%rsi
jmp    1245 <body+0xe5>
lea    0xdfa(%rip),%rsi
mov    %rsp,%rdx
mov    %r14,%rdi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [5 x i8] c"====\00"
@.str.2 = [20 x i8] c"extern char *%s[];\0A\00"
@.str.3 = [36 x i8] c"Error: help input line\0A %s\0Ais bad\0A\00"
@.str.4 = [64 x i8] c"Error: help input\0A %scontains ==== without following helpname\0A\00"
@.str.5 = [61 x i8] c"Error: help input\0A %scontains ==== without following space\0A\00"
define void @body(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [10000 x i8]
%6 = alloca i8*
%7 = alloca i8*
store i32* %0, i32** %3
store i32* %1, i32** %4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %6
br label %8
8: ; preds = %55, %2
%9 = getelementptr inbounds [10000 x i8], [10000 x i8]* %5, i64 0, i64 0
%10 = load i32*, i32** %3
%11 = call i32* @fgets(i8* %9, i32 10000, i32* %10)
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %56
13: ; preds = %8
%14 = getelementptr inbounds [10000 x i8], [10000 x i8]* %5, i64 0, i64 0
%15 = call i32 @strncmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%16 = icmp ne i32 %15, 0
br i1 %16, label %55, label %17
17: ; preds = %13
%18 = getelementptr inbounds [10000 x i8], [10000 x i8]* %5, i64 0, i64 0
%19 = load i8*, i8** %6
%20 = call i8* @strtok(i8* %18, i8* %19)
store i8* %20, i8** %7
%21 = load i8*, i8** %7
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %49
23: ; preds = %17
%24 = load i8*, i8** %6
%25 = call i8* @strtok(i8* null, i8* %24)
store i8* %25, i8** %7
%26 = load i8*, i8** %7
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %43
28: ; preds = %23
%29 = load i8*, i8** %7
%30 = load i8, i8* %29
%31 = call i64 @isalpha(i8 signext %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = load i32*, i32** %4
%35 = load i8*, i8** %7
%36 = call i32 @fprintf(i32* %34, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %35)
br label %42
37: ; preds = %28
%38 = load i32*, i32** %4
%39 = getelementptr inbounds [10000 x i8], [10000 x i8]* %5, i64 0, i64 0
%40 = call i32 @fprintf(i32* %38, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %39)
%41 = call i32 @exit(i32 -1)
unreachable
42: ; preds = %33
br label %48
43: ; preds = %23
%44 = load i32*, i32** %4
%45 = getelementptr inbounds [10000 x i8], [10000 x i8]* %5, i64 0, i64 0
%46 = call i32 @fprintf(i32* %44, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i8* %45)
%47 = call i32 @exit(i32 -1)
unreachable
48: ; preds = %42
br label %54
49: ; preds = %17
%50 = load i32*, i32** %4
%51 = getelementptr inbounds [10000 x i8], [10000 x i8]* %5, i64 0, i64 0
%52 = call i32 @fprintf(i32* %50, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i8* %51)
%53 = call i32 @exit(i32 -1)
unreachable
54: ; preds = %48
br label %55
55: ; preds = %54, %13
br label %8
56: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [5 x i8] c"====\00"
@.str.2 = [20 x i8] c"extern char *%s[];\0A\00"
@.str.3 = [36 x i8] c"Error: help input line\0A %s\0Ais bad\0A\00"
@.str.4 = [64 x i8] c"Error: help input\0A %scontains ==== without following helpname\0A\00"
@.str.5 = [61 x i8] c"Error: help input\0A %scontains ==== without following space\0A\00"
define void @body(i32* nocapture %0, i32* nocapture %1) {
%3 = alloca [10000 x i8]
%4 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%5 = call i32* @fgets(i8* %4, i32 10000, i32* %0)
%6 = icmp eq i32* %5, null
br i1 %6, label %34, label %7
7: ; preds = %2, %31
%8 = call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %31
10: ; preds = %7
%11 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %28, label %13
13: ; preds = %10
%14 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i8* %14, null
br i1 %15, label %25, label %16
16: ; preds = %13
%17 = load i8, i8* %14
%18 = call i64 @isalpha(i8 signext %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %14)
br label %31
22: ; preds = %16
%23 = call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%24 = call i32 @exit(i32 -1)
unreachable
25: ; preds = %13
%26 = call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%27 = call i32 @exit(i32 -1)
unreachable
28: ; preds = %10
%29 = call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%30 = call i32 @exit(i32 -1)
unreachable
31: ; preds = %20, %7
%32 = call i32* @fgets(i8* %4, i32 10000, i32* %0)
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %7
34: ; preds = %31, %2
ret void
}