#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 */
scalar_t__ feof(int /*<<< orphan*/ *);
unsigned char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
unsigned int fread(unsigned char *, int, unsigned int, int /*<<< orphan*/ *);
unsigned int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int nextcmd(FILE *infile, unsigned char *cmd, unsigned char *buf,
            unsigned int *cnt, unsigned int *xml_read) {
  unsigned char c1, c2;
  unsigned int startxml, endxml;
  if (feof(infile))
    return -1;
  while (!feof(infile)) {
    c1 = fgetc(infile);
    if (feof(infile))
      return 1;
    if (c1 == 60) {
      if (*xml_read == 0) {
        startxml = 680 - 1;
        fread(buf, 1, startxml, infile);
        fprintf(stderr, "nextcmd: read starting XML %d %d\n", *xml_read,
                startxml);
        *xml_read = 1;
      } else if (*xml_read == 1) {
        endxml = 263 - 1;
        fread(buf, 1, endxml, infile);
        fprintf(stderr, "nextcmd: read ending XML %d %d\n", *xml_read, endxml);
        *xml_read = 2;
      }
    } else if (c1 == 27) {
      c2 = fgetc(infile);
      if (feof(infile))
        return 1;
      if (c2 == '[' || c2 == '(') {
        *cmd = fgetc(infile);
        if (feof(infile))
          return 1;
        c1 = fgetc(infile);
        c2 = fgetc(infile);
        *cnt = c1 + (c2 << 8);
        if (*cnt) {
          unsigned int read;
          if ((read = fread(buf, 1, *cnt, infile)) != *cnt) {
            fprintf(stderr, "nextcmd: read error - not enough data %d %d\n",
                    read, *cnt);
            return -1;
          }
        }
        return 0;
      } else if (c2 == '@') {
        fprintf(stderr, "ESC @ Return to neutral mode\n");
      } else {
        fprintf(stderr, "unknown byte following ESC %x \n", c2);
      }
    } else if (c1 == 0x0c) {
      fprintf(stderr, "-->Form Feed\n");
    } else {
      fprintf(stderr, "UNKNOWN BYTE 0x%x @ %lu\n", c1, ftell(infile));
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<nextcmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
je     118b <nextcmd+0x3b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1479 <nextcmd+0x329>
jmp    1190 <nextcmd+0x40>
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11af <nextcmd+0x5f>
jmp    1472 <nextcmd+0x322>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x31(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
je     11da <nextcmd+0x8a>
movl   $0x1,-0x4(%rbp)
jmp    1479 <nextcmd+0x329>
movzbl -0x31(%rbp),%eax
cmp    $0x3c,%eax
jne    129c <nextcmd+0x14c>
mov    -0x30(%rbp),%rax
cmpl   $0x0,(%rax)
jne    123f <nextcmd+0xef>
movl   $0x2a7,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
mov    -0x38(%rbp),%ecx
lea    0xdd7(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
jmp    1297 <nextcmd+0x147>
mov    -0x30(%rbp),%rax
cmpl   $0x1,(%rax)
jne    1292 <nextcmd+0x142>
movl   $0x106,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x3c(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
mov    -0x3c(%rbp),%ecx
lea    0xda1(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x30(%rbp),%rax
movl   $0x2,(%rax)
jmp    1297 <nextcmd+0x147>
jmp    146d <nextcmd+0x31d>
movzbl -0x31(%rbp),%eax
cmp    $0x1b,%eax
jne    1408 <nextcmd+0x2b8>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x32(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
je     12d4 <nextcmd+0x184>
movl   $0x1,-0x4(%rbp)
jmp    1479 <nextcmd+0x329>
movzbl -0x32(%rbp),%eax
cmp    $0x5b,%eax
je     12ee <nextcmd+0x19e>
movzbl -0x32(%rbp),%eax
cmp    $0x28,%eax
jne    13ba <nextcmd+0x26a>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
je     131e <nextcmd+0x1ce>
movl   $0x1,-0x4(%rbp)
jmp    1479 <nextcmd+0x329>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x31(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x32(%rbp)
movzbl -0x31(%rbp),%ecx
movzbl -0x32(%rbp),%eax
shl    $0x8,%eax
add    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
je     13ae <nextcmd+0x25e>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %eax,-0x40(%rbp)
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
je     13a9 <nextcmd+0x259>
mov    0x2c5c(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%edx
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
lea    0xcac(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1479 <nextcmd+0x329>
jmp    13ae <nextcmd+0x25e>
movl   $0x0,-0x4(%rbp)
jmp    1479 <nextcmd+0x329>
movzbl -0x32(%rbp),%eax
cmp    $0x40,%eax
jne    13e3 <nextcmd+0x293>
mov    0x2c12(%rip),%rax
mov    (%rax),%edi
lea    0xc98(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    13fe <nextcmd+0x2ae>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
movzbl -0x32(%rbp),%edx
lea    0xc96(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1403 <nextcmd+0x2b3>
jmp    1468 <nextcmd+0x318>
movzbl -0x31(%rbp),%eax
cmp    $0xc,%eax
jne    1431 <nextcmd+0x2e1>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
lea    0xc88(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1463 <nextcmd+0x313>
mov    0x2ba8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
movzbl -0x31(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <ftell@plt>
mov    -0x48(%rbp),%edi
mov    -0x44(%rbp),%edx
mov    %eax,%ecx
lea    0xc5f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1468 <nextcmd+0x318>
jmp    146d <nextcmd+0x31d>
jmp    1190 <nextcmd+0x40>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextcmd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,%r12
call   1070 <feof@plt>
test   %rax,%rax
jne    1184 <nextcmd+0x34>
mov    %r12,%rdi
call   1070 <feof@plt>
test   %rax,%rax
je     119c <nextcmd+0x4c>
mov    $0xffffffff,%r13d
mov    %r13d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,0x10(%rsp)
mov    %rbp,(%rsp)
mov    %r14,0x8(%rsp)
mov    0x2e2f(%rip),%rbp
mov    $0x1,%r13d
jmp    11f1 <nextcmd+0xa1>
nopl   0x0(%rax)
movzbl %r14b,%r14d
mov    0x0(%rbp),%ebx
mov    %r12,%rdi
call   1060 <ftell@plt>
mov    %ebx,%edi
lea    0xee3(%rip),%rsi
mov    %r14d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %r12,%rdi
call   1070 <feof@plt>
test   %rax,%rax
jne    1184 <nextcmd+0x34>
mov    %r12,%rdi
call   1040 <fgetc@plt>
mov    %eax,%r14d
mov    %r12,%rdi
call   1070 <feof@plt>
test   %rax,%rax
jne    118a <nextcmd+0x3a>
cmp    $0xc,%r14b
je     1270 <nextcmd+0x120>
cmp    $0x1b,%r14b
je     1280 <nextcmd+0x130>
cmp    $0x3c,%r14b
jne    11c0 <nextcmd+0x70>
mov    (%r15),%eax
cmp    $0x1,%eax
je     12d9 <nextcmd+0x189>
test   %eax,%eax
jne    11e4 <nextcmd+0x94>
mov    (%rsp),%rdi
mov    $0x1,%esi
mov    $0x2a7,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
mov    0x0(%rbp),%edi
mov    (%r15),%edx
lea    0xdb2(%rip),%rsi
mov    $0x2a7,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
movl   $0x1,(%r15)
jmp    11e4 <nextcmd+0x94>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp),%edi
lea    0xe33(%rip),%rsi
jmp    12cd <nextcmd+0x17d>
nopl   0x0(%rax)
mov    %r12,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1070 <feof@plt>
test   %rax,%rax
jne    118a <nextcmd+0x3a>
cmp    $0x40,%bl
je     12c3 <nextcmd+0x173>
cmp    $0x5b,%bl
je     1314 <nextcmd+0x1c4>
cmp    $0x28,%bl
je     1314 <nextcmd+0x1c4>
movzbl %bl,%edx
mov    0x0(%rbp),%edi
lea    0xdd6(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11e4 <nextcmd+0x94>
mov    0x0(%rbp),%edi
lea    0xda2(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11e4 <nextcmd+0x94>
mov    (%rsp),%rdi
mov    $0x1,%esi
mov    $0x106,%edx
mov    %r12,%rcx
call   1030 <fread@plt>
mov    0x0(%rbp),%edi
mov    (%r15),%edx
lea    0xd26(%rip),%rsi
mov    $0x106,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
movl   $0x2,(%r15)
jmp    11e4 <nextcmd+0x94>
mov    %r12,%rdi
call   1040 <fgetc@plt>
mov    0x10(%rsp),%rcx
mov    %al,(%rcx)
mov    %r12,%rdi
call   1070 <feof@plt>
test   %rax,%rax
jne    118a <nextcmd+0x3a>
mov    %r12,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1040 <fgetc@plt>
movzbl %bl,%ecx
movzbl %al,%edx
shl    $0x8,%edx
xor    %r13d,%r13d
or     %ecx,%edx
mov    0x8(%rsp),%rbx
mov    %edx,(%rbx)
je     118a <nextcmd+0x3a>
mov    (%rsp),%rdi
mov    $0x1,%esi
mov    %r12,%rcx
call   1030 <fread@plt>
mov    (%rbx),%ecx
cmp    %ecx,%eax
je     118a <nextcmd+0x3a>
mov    0x0(%rbp),%edi
lea    0xcbc(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    1184 <nextcmd+0x34>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"nextcmd: read starting XML %d %d\0A\00"
@.str.1 = [32 x i8] c"nextcmd: read ending XML %d %d\0A\00"
@.str.2 = [45 x i8] c"nextcmd: read error - not enough data %d %d\0A\00"
@.str.3 = [30 x i8] c"ESC @ Return to neutral mode\0A\00"
@.str.4 = [32 x i8] c"unknown byte following ESC %x \0A\00"
@.str.5 = [14 x i8] c"-->Form Feed\0A\00"
@.str.6 = [25 x i8] c"UNKNOWN BYTE 0x%x @ %lu\0A\00"
define i32 @nextcmd(i32* %0, i8* %1, i8* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i8
%13 = alloca i8
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32* %0, i32** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
%17 = load i32*, i32** %7
%18 = call i64 @feof(i32* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %5
store i32 -1, i32* %6
br label %161
21: ; preds = %5
br label %22
22: ; preds = %159, %21
%23 = load i32*, i32** %7
%24 = call i64 @feof(i32* %23)
%25 = icmp ne i64 %24, 0
%26 = xor i1 %25, true
br i1 %26, label %27, label %160
27: ; preds = %22
%28 = load i32*, i32** %7
%29 = call zeroext i8 @fgetc(i32* %28)
store i8 %29, i8* %12
%30 = load i32*, i32** %7
%31 = call i64 @feof(i32* %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %27
store i32 1, i32* %6
br label %161
34: ; preds = %27
%35 = load i8, i8* %12
%36 = zext i8 %35 to i32
%37 = icmp eq i32 %36, 60
br i1 %37, label %38, label %70
38: ; preds = %34
%39 = load i32*, i32** %11
%40 = load i32, i32* %39
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %53
42: ; preds = %38
store i32 679, i32* %14
%43 = load i8*, i8** %9
%44 = load i32, i32* %14
%45 = load i32*, i32** %7
%46 = call i32 @fread(i8* %43, i32 1, i32 %44, i32* %45)
%47 = load i32, i32* @stderr
%48 = load i32*, i32** %11
%49 = load i32, i32* %48
%50 = load i32, i32* %14
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %49, i32 %50)
%52 = load i32*, i32** %11
store i32 1, i32* %52
br label %69
53: ; preds = %38
%54 = load i32*, i32** %11
%55 = load i32, i32* %54
%56 = icmp eq i32 %55, 1
br i1 %56, label %57, label %68
57: ; preds = %53
store i32 262, i32* %15
%58 = load i8*, i8** %9
%59 = load i32, i32* %15
%60 = load i32*, i32** %7
%61 = call i32 @fread(i8* %58, i32 1, i32 %59, i32* %60)
%62 = load i32, i32* @stderr
%63 = load i32*, i32** %11
%64 = load i32, i32* %63
%65 = load i32, i32* %15
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %64, i32 %65)
%67 = load i32*, i32** %11
store i32 2, i32* %67
br label %68
68: ; preds = %57, %53
br label %69
69: ; preds = %68, %42
br label %159
70: ; preds = %34
%71 = load i8, i8* %12
%72 = zext i8 %71 to i32
%73 = icmp eq i32 %72, 27
br i1 %73, label %74, label %143
74: ; preds = %70
%75 = load i32*, i32** %7
%76 = call zeroext i8 @fgetc(i32* %75)
store i8 %76, i8* %13
%77 = load i32*, i32** %7
%78 = call i64 @feof(i32* %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %81
80: ; preds = %74
store i32 1, i32* %6
br label %161
81: ; preds = %74
%82 = load i8, i8* %13
%83 = zext i8 %82 to i32
%84 = icmp eq i32 %83, 91
br i1 %84, label %89, label %85
85: ; preds = %81
%86 = load i8, i8* %13
%87 = zext i8 %86 to i32
%88 = icmp eq i32 %87, 40
br i1 %88, label %89, label %129
89: ; preds = %85, %81
%90 = load i32*, i32** %7
%91 = call zeroext i8 @fgetc(i32* %90)
%92 = load i8*, i8** %8
store i8 %91, i8* %92
%93 = load i32*, i32** %7
%94 = call i64 @feof(i32* %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %89
store i32 1, i32* %6
br label %161
97: ; preds = %89
%98 = load i32*, i32** %7
%99 = call zeroext i8 @fgetc(i32* %98)
store i8 %99, i8* %12
%100 = load i32*, i32** %7
%101 = call zeroext i8 @fgetc(i32* %100)
store i8 %101, i8* %13
%102 = load i8, i8* %12
%103 = zext i8 %102 to i32
%104 = load i8, i8* %13
%105 = zext i8 %104 to i32
%106 = shl i32 %105, 8
%107 = add nsw i32 %103, %106
%108 = load i32*, i32** %10
store i32 %107, i32* %108
%109 = load i32*, i32** %10
%110 = load i32, i32* %109
%111 = icmp ne i32 %110, 0
br i1 %111, label %112, label %128
112: ; preds = %97
%113 = load i8*, i8** %9
%114 = load i32*, i32** %10
%115 = load i32, i32* %114
%116 = load i32*, i32** %7
%117 = call i32 @fread(i8* %113, i32 1, i32 %115, i32* %116)
store i32 %117, i32* %16
%118 = load i32*, i32** %10
%119 = load i32, i32* %118
%120 = icmp ne i32 %117, %119
br i1 %120, label %121, label %127
121: ; preds = %112
%122 = load i32, i32* @stderr
%123 = load i32, i32* %16
%124 = load i32*, i32** %10
%125 = load i32, i32* %124
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %122, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 %123, i32 %125)
store i32 -1, i32* %6
br label %161
127: ; preds = %112
br label %128
128: ; preds = %127, %97
store i32 0, i32* %6
br label %161
129: ; preds = %85
%130 = load i8, i8* %13
%131 = zext i8 %130 to i32
%132 = icmp eq i32 %131, 64
br i1 %132, label %133, label %136
133: ; preds = %129
%134 = load i32, i32* @stderr
%135 = call i32 (i32, i8*, ...) @fprintf(i32 %134, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %141
136: ; preds = %129
%137 = load i32, i32* @stderr
%138 = load i8, i8* %13
%139 = zext i8 %138 to i32
%140 = call i32 (i32, i8*, ...) @fprintf(i32 %137, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i32 %139)
br label %141
141: ; preds = %136, %133
br label %142
142: ; preds = %141
br label %158
143: ; preds = %70
%144 = load i8, i8* %12
%145 = zext i8 %144 to i32
%146 = icmp eq i32 %145, 12
br i1 %146, label %147, label %150
147: ; preds = %143
%148 = load i32, i32* @stderr
%149 = call i32 (i32, i8*, ...) @fprintf(i32 %148, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %157
150: ; preds = %143
%151 = load i32, i32* @stderr
%152 = load i8, i8* %12
%153 = zext i8 %152 to i32
%154 = load i32*, i32** %7
%155 = call i32 @ftell(i32* %154)
%156 = call i32 (i32, i8*, ...) @fprintf(i32 %151, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %153, i32 %155)
br label %157
157: ; preds = %150, %147
br label %158
158: ; preds = %157, %142
br label %159
159: ; preds = %158, %69
br label %22
160: ; preds = %22
store i32 -1, i32* %6
br label %161
161: ; preds = %160, %128, %121, %96, %80, %33, %20
%162 = load i32, i32* %6
ret i32 %162
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"nextcmd: read starting XML %d %d\0A\00"
@.str.1 = [32 x i8] c"nextcmd: read ending XML %d %d\0A\00"
@.str.2 = [45 x i8] c"nextcmd: read error - not enough data %d %d\0A\00"
@.str.3 = [30 x i8] c"ESC @ Return to neutral mode\0A\00"
@.str.4 = [32 x i8] c"unknown byte following ESC %x \0A\00"
@.str.5 = [14 x i8] c"-->Form Feed\0A\00"
@.str.6 = [25 x i8] c"UNKNOWN BYTE 0x%x @ %lu\0A\00"
define i32 @nextcmd(i32* nocapture %0, i8* nocapture writeonly %1, i8* nocapture %2, i32* nocapture %3, i32* nocapture %4) {
%6 = tail call i64 @feof(i32* %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %70
8: ; preds = %5
%9 = tail call i64 @feof(i32* %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %70
11: ; preds = %8, %67
%12 = tail call zeroext i8 @fgetc(i32* %0)
%13 = tail call i64 @feof(i32* %0)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %70
15: ; preds = %11
switch i8 %12, label %62 [
i8 60, label %16
i8 27, label %28
i8 12, label %59
]
16: ; preds = %15
%17 = load i32, i32* %4
switch i32 %17, label %67 [
i32 0, label %18
i32 1, label %23
]
18: ; preds = %16
%19 = tail call i32 @fread(i8* %2, i32 1, i32 679, i32* %0)
%20 = load i32, i32* @stderr
%21 = load i32, i32* %4
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %21, i32 679)
store i32 1, i32* %4
br label %67
23: ; preds = %16
%24 = tail call i32 @fread(i8* %2, i32 1, i32 262, i32* %0)
%25 = load i32, i32* @stderr
%26 = load i32, i32* %4
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %26, i32 262)
store i32 2, i32* %4
br label %67
28: ; preds = %15
%29 = tail call zeroext i8 @fgetc(i32* %0)
%30 = tail call i64 @feof(i32* %0)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %70
32: ; preds = %28
switch i8 %29, label %55 [
i8 91, label %33
i8 40, label %33
i8 64, label %52
]
33: ; preds = %32, %32
%34 = tail call zeroext i8 @fgetc(i32* %0)
store i8 %34, i8* %1
%35 = tail call i64 @feof(i32* %0)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %70
37: ; preds = %33
%38 = tail call zeroext i8 @fgetc(i32* %0)
%39 = tail call zeroext i8 @fgetc(i32* %0)
%40 = zext i8 %38 to i32
%41 = zext i8 %39 to i32
%42 = shl nuw nsw i32 %41, 8
%43 = or i32 %42, %40
store i32 %43, i32* %3
%44 = icmp eq i32 %43, 0
br i1 %44, label %70, label %45
45: ; preds = %37
%46 = tail call i32 @fread(i8* %2, i32 1, i32 %43, i32* %0)
%47 = load i32, i32* %3
%48 = icmp eq i32 %46, %47
br i1 %48, label %70, label %49
49: ; preds = %45
%50 = load i32, i32* @stderr
%51 = tail call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 %46, i32 %47)
br label %70
52: ; preds = %32
%53 = load i32, i32* @stderr
%54 = tail call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %67
55: ; preds = %32
%56 = zext i8 %29 to i32
%57 = load i32, i32* @stderr
%58 = tail call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i32 %56)
br label %67
59: ; preds = %15
%60 = load i32, i32* @stderr
%61 = tail call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %67
62: ; preds = %15
%63 = zext i8 %12 to i32
%64 = load i32, i32* @stderr
%65 = tail call i32 @ftell(i32* %0)
%66 = tail call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %63, i32 %65)
br label %67
67: ; preds = %16, %52, %55, %62, %59, %18, %23
%68 = tail call i64 @feof(i32* %0)
%69 = icmp eq i64 %68, 0
br i1 %69, label %11, label %70
70: ; preds = %11, %28, %67, %8, %37, %45, %49, %33, %5
%71 = phi i32 [ -1, %49 ], [ -1, %5 ], [ 1, %33 ], [ 0, %45 ], [ 0, %37 ], [ -1, %8 ], [ 1, %11 ], [ 1, %28 ], [ -1, %67 ]
ret i32 %71
}