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

/* Variables and functions */
scalar_t__ command(char const *, char const **, int /*<<< orphan*/ *,
                   char const *, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
scalar_t__ isatty(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int strcspn(char *, char *);
int strspn(char *, char *);
void process(char const *progname, FILE *fp, char const *filename) {
  int line = 0;
  for (;;) {
    char buf[1024 * 8];
    size_t argc = 0;
    char const *argv[128];
    char *arg;
    line++;
    if (isatty(fileno(fp))) {
      fputs("graphdateline? ", stderr);
      fflush(stderr);
    }
    if (fgets(buf, sizeof buf, fp) == NULL)
      break;
    arg = buf + strspn(buf, " \t");
    if (*arg == '#' || *arg == '\n')
      continue;
    for (argc = 0; argc < sizeof(argv) / sizeof(*argv) - 1;) {
      int cc;
      argv[argc++] = arg;
      cc = strcspn(arg, "\n \t\r\n");
      arg += cc;
      if (*arg == '\n' || *arg == '\0') {
        *arg = '\0';
        break;
      }
      *arg++ = '\0';
      arg += strspn(arg, " \t\n");
      if (*arg == '\0' || *arg == '\n')
        break;
    }
    argv[argc] = NULL;
    if (command(progname, argv, fp, filename, line))
      return;
  }
}


x86 assembly (clang, -O0):
<process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2450,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x2028(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <fileno@plt>
mov    %eax,%edi
call   1030 <isatty@plt>
cmp    $0x0,%rax
je     11ef <process+0x6f>
mov    0x2e0d(%rip),%rax
mov    (%rax),%esi
lea    0xe24(%rip),%rdi
call   1050 <fputs@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
lea    -0x2020(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x2000,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    1213 <process+0x93>
jmp    13ce <process+0x24e>
lea    -0x2020(%rbp),%rax
mov    %rax,-0x2448(%rbp)
lea    -0x2020(%rbp),%rdi
lea    0xde1(%rip),%rsi
call   1060 <strspn@plt>
mov    %eax,%ecx
mov    -0x2448(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x2438(%rbp)
mov    -0x2438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
je     1270 <process+0xf0>
mov    -0x2438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1275 <process+0xf5>
jmp    119e <process+0x1e>
movq   $0x0,-0x2028(%rbp)
cmpq   $0x7f,-0x2028(%rbp)
7f
jae    138b <process+0x20b>
mov    -0x2438(%rbp),%rcx
mov    -0x2028(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x2028(%rbp)
mov    %rcx,-0x2430(%rbp,%rax,8)
ff
mov    -0x2438(%rbp),%rdi
lea    0xd53(%rip),%rsi
call   1070 <strcspn@plt>
mov    %eax,-0x243c(%rbp)
mov    -0x243c(%rbp),%ecx
mov    -0x2438(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x2438(%rbp)
mov    -0x2438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     130b <process+0x18b>
mov    -0x2438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    131a <process+0x19a>
mov    -0x2438(%rbp),%rax
movb   $0x0,(%rax)
jmp    138b <process+0x20b>
mov    -0x2438(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x2438(%rbp)
movb   $0x0,(%rax)
mov    -0x2438(%rbp),%rdi
lea    0xcd9(%rip),%rsi
call   1060 <strspn@plt>
mov    %eax,%ecx
mov    -0x2438(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x2438(%rbp)
mov    -0x2438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1381 <process+0x201>
mov    -0x2438(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1386 <process+0x206>
jmp    138b <process+0x20b>
jmp    1280 <process+0x100>
mov    -0x2028(%rbp),%rax
movq   $0x0,-0x2430(%rbp,%rax,8)
mov    -0x8(%rbp),%rdi
lea    -0x2430(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1040 <command@plt>
cmp    $0x0,%rax
je     13c9 <process+0x249>
jmp    13ce <process+0x24e>
jmp    119e <process+0x1e>
add    $0x2450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2428,%rsp
mov    %rdx,0x10(%rsp)
mov    %rsi,%r13
mov    %rdi,0x8(%rsp)
xor    %ebp,%ebp
lea    0x420(%rsp),%r14
lea    0xe61(%rip),%r15
mov    0x2e2a(%rip),%r12
lea    0xe43(%rip),%rbx
mov    %rsi,(%rsp)
jmp    1215 <process+0x95>
movb   $0x0,(%r15)
add    $0x1,%r13
lea    0xe3e(%rip),%r15
mov    0x2e07(%rip),%r12
movq   $0x0,0x20(%rsp,%r13,8)
mov    0x8(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    (%rsp),%r13
mov    %r13,%rdx
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%rbp
mov    %ebp,%r8d
call   1040 <command@plt>
test   %rax,%rax
lea    0xdf1(%rip),%rbx
jne    130a <process+0x18a>
mov    %r13,%rdi
call   1090 <fileno@plt>
mov    %eax,%edi
call   1030 <isatty@plt>
test   %rax,%rax
je     123e <process+0xbe>
mov    (%r12),%esi
mov    %rbx,%rdi
call   1050 <fputs@plt>
mov    (%r12),%edi
call   10a0 <fflush@plt>
mov    %r14,%rdi
mov    $0x2000,%esi
mov    %r13,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     130a <process+0x18a>
add    $0x1,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <strspn@plt>
cltq
mov    0x420(%rsp,%rax,1),%cl
cmp    $0xa,%cl
je     1215 <process+0x95>
cmp    $0x23,%cl
je     1215 <process+0x95>
mov    %rbp,0x18(%rsp)
lea    (%rsp,%rax,1),%rbp
add    $0x420,%rbp
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
cmp    $0x7f,%r13
je     12ff <process+0x17f>
mov    %rbp,0x20(%rsp,%r13,8)
mov    %rbp,%rdi
lea    0xd6e(%rip),%rsi
call   1070 <strcspn@plt>
cltq
lea    (%rax,%rbp,1),%r15
movzbl 0x0(%rbp,%rax,1),%eax
cmp    $0xa,%al
je     11c3 <process+0x43>
test   %al,%al
je     11c3 <process+0x43>
lea    0x1(%r15),%rdi
movb   $0x0,(%r15)
lea    0xd45(%rip),%rsi
call   1060 <strspn@plt>
movslq %eax,%rcx
movzbl 0x1(%r15,%rcx,1),%eax
add    $0x1,%r13
cmp    $0xa,%al
je     11cb <process+0x4b>
lea    (%r15,%rcx,1),%rbp
add    $0x1,%rbp
test   %al,%al
jne    1290 <process+0x110>
jmp    11cb <process+0x4b>
mov    $0x7f,%r13d
jmp    11cb <process+0x4b>
add    $0x2428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"graphdateline? \00"
@stderr = global i32 0
@.str.1 = [3 x i8] c" \09\00"
@.str.2 = [6 x i8] c"\0A \09\0D\0A\00"
@.str.3 = [4 x i8] c" \09\0A\00"
define void @process(i8* %0, i32* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [8192 x i8]
%9 = alloca i64
%10 = alloca [128 x i8*]
%11 = alloca i8*
%12 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
store i32 0, i32* %7
br label %13
13: ; preds = %103, %46, %3
store i64 0, i64* %9
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
store i32 %15, i32* %7
%16 = load i32*, i32** %5
%17 = call i32 @fileno(i32* %16)
%18 = call i64 @isatty(i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %13
%21 = load i32, i32* @stderr
%22 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @stderr
%24 = call i32 @fflush(i32 %23)
br label %25
25: ; preds = %20, %13
%26 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%27 = load i32*, i32** %5
%28 = call i32* @fgets(i8* %26, i32 8192, i32* %27)
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %31
30: ; preds = %25
br label %104
31: ; preds = %25
%32 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%33 = getelementptr inbounds [8192 x i8], [8192 x i8]* %8, i64 0, i64 0
%34 = call i32 @strspn(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %32, i64 %35
store i8* %36, i8** %11
%37 = load i8*, i8** %11
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 35
br i1 %40, label %46, label %41
41: ; preds = %31
%42 = load i8*, i8** %11
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 10
br i1 %45, label %46, label %47
46: ; preds = %41, %31
br label %13
47: ; preds = %41
store i64 0, i64* %9
br label %48
48: ; preds = %91, %47
%49 = load i64, i64* %9
%50 = icmp ult i64 %49, 127
br i1 %50, label %51, label %92
51: ; preds = %48
%52 = load i8*, i8** %11
%53 = load i64, i64* %9
%54 = add i64 %53, 1
store i64 %54, i64* %9
%55 = getelementptr inbounds [128 x i8*], [128 x i8*]* %10, i64 0, i64 %53
store i8* %52, i8** %55
%56 = load i8*, i8** %11
%57 = call i32 @strcspn(i8* %56, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 %57, i32* %12
%58 = load i32, i32* %12
%59 = load i8*, i8** %11
%60 = sext i32 %58 to i64
%61 = getelementptr inbounds i8, i8* %59, i64 %60
store i8* %61, i8** %11
%62 = load i8*, i8** %11
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 10
br i1 %65, label %71, label %66
66: ; preds = %51
%67 = load i8*, i8** %11
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %66, %51
%72 = load i8*, i8** %11
store i8 0, i8* %72
br label %92
73: ; preds = %66
%74 = load i8*, i8** %11
%75 = getelementptr inbounds i8, i8* %74, i32 1
store i8* %75, i8** %11
store i8 0, i8* %74
%76 = load i8*, i8** %11
%77 = call i32 @strspn(i8* %76, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%78 = load i8*, i8** %11
%79 = sext i32 %77 to i64
%80 = getelementptr inbounds i8, i8* %78, i64 %79
store i8* %80, i8** %11
%81 = load i8*, i8** %11
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp eq i32 %83, 0
br i1 %84, label %90, label %85
85: ; preds = %73
%86 = load i8*, i8** %11
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 10
br i1 %89, label %90, label %91
90: ; preds = %85, %73
br label %92
91: ; preds = %85
br label %48
92: ; preds = %90, %71, %48
%93 = load i64, i64* %9
%94 = getelementptr inbounds [128 x i8*], [128 x i8*]* %10, i64 0, i64 %93
store i8* null, i8** %94
%95 = load i8*, i8** %4
%96 = getelementptr inbounds [128 x i8*], [128 x i8*]* %10, i64 0, i64 0
%97 = load i32*, i32** %5
%98 = load i8*, i8** %6
%99 = load i32, i32* %7
%100 = call i64 @command(i8* %95, i8** %96, i32* %97, i8* %98, i32 %99)
%101 = icmp ne i64 %100, 0
br i1 %101, label %102, label %103
102: ; preds = %92
br label %104
103: ; preds = %92
br label %13
104: ; preds = %102, %30
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"graphdateline? \00"
@stderr = global i32 0
@.str.1 = [3 x i8] c" \09\00"
@.str.2 = [6 x i8] c"\0A \09\0D\0A\00"
@.str.3 = [4 x i8] c" \09\0A\00"
define void @process(i8* %0, i32* %1, i8* %2) {
%4 = alloca [8192 x i8]
%5 = alloca [128 x i8*]
%6 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%7 = bitcast [128 x i8*]* %5 to i8*
%8 = getelementptr inbounds [128 x i8*], [128 x i8*]* %5, i64 0, i64 0
br label %9
9: ; preds = %51, %3
%10 = phi i32 [ 0, %3 ], [ %11, %51 ]
%11 = add nuw nsw i32 %10, 1
%12 = call i32 @fileno(i32* %1)
%13 = call i64 @isatty(i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %9
%16 = load i32, i32* @stderr
%17 = call i32 @fputs(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @stderr
%19 = call i32 @fflush(i32 %18)
br label %20
20: ; preds = %15, %9
%21 = call i32* @fgets(i8* %6, i32 8192, i32* %1)
%22 = icmp eq i32* %21, null
br i1 %22, label %52, label %23
23: ; preds = %20
%24 = call i32 @strspn(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 %25
%27 = load i8, i8* %26
switch i8 %27, label %28 [
i8 35, label %51
i8 10, label %51
]
28: ; preds = %23, %40
%29 = phi i64 [ %33, %40 ], [ 0, %23 ]
%30 = phi i8* [ %44, %40 ], [ %26, %23 ]
%31 = icmp eq i64 %29, 127
br i1 %31, label %46, label %32
32: ; preds = %28
%33 = add nuw nsw i64 %29, 1
%34 = getelementptr inbounds [128 x i8*], [128 x i8*]* %5, i64 0, i64 %29
store i8* %30, i8** %34
%35 = call i32 @strcspn(i8* %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %30, i64 %36
%38 = load i8, i8* %37
switch i8 %38, label %40 [
i8 10, label %39
i8 0, label %39
]
39: ; preds = %32, %32
store i8 0, i8* %37
br label %46
40: ; preds = %32
%41 = getelementptr inbounds i8, i8* %37, i64 1
store i8 0, i8* %37
%42 = call i32 @strspn(i8* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
%45 = load i8, i8* %44
switch i8 %45, label %28 [
i8 0, label %46
i8 10, label %46
]
46: ; preds = %40, %40, %28, %39
%47 = phi i64 [ %33, %39 ], [ %33, %40 ], [ %33, %40 ], [ 127, %28 ]
%48 = getelementptr inbounds [128 x i8*], [128 x i8*]* %5, i64 0, i64 %47
store i8* null, i8** %48
%49 = call i64 @command(i8* %0, i8** %8, i32* %1, i8* %2, i32 %11)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %23, %23, %46
br label %9
52: ; preds = %46, %20
ret void
}