#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;
  unsigned int xmldata;
  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;
        xmldata = fread(buf, 1, 679, infile);
        fprintf(stderr, "nextcmd: read starting XML %d %d\n", *xml_read,
                startxml);
        *xml_read = 1;
      } else if (*xml_read == 1) {
        endxml = 263;
        xmldata = fread(buf, 1, 262, 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    1483 <nextcmd+0x333>
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    147c <nextcmd+0x32c>
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    1483 <nextcmd+0x333>
movzbl -0x31(%rbp),%eax
cmp    $0x3c,%eax
jne    12a6 <nextcmd+0x156>
mov    -0x30(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1244 <nextcmd+0xf4>
movl   $0x2a8,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2a7,%edx
call   1030 <fread@plt>
mov    %eax,-0x40(%rbp)
mov    0x2dc4(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
mov    -0x38(%rbp),%ecx
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x30(%rbp),%rax
movl   $0x1,(%rax)
jmp    12a1 <nextcmd+0x151>
mov    -0x30(%rbp),%rax
cmpl   $0x1,(%rax)
jne    129c <nextcmd+0x14c>
movl   $0x107,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x106,%edx
call   1030 <fread@plt>
mov    %eax,-0x40(%rbp)
mov    0x2d67(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
mov    -0x3c(%rbp),%ecx
lea    0xd97(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x30(%rbp),%rax
movl   $0x2,(%rax)
jmp    12a1 <nextcmd+0x151>
jmp    1477 <nextcmd+0x327>
movzbl -0x31(%rbp),%eax
cmp    $0x1b,%eax
jne    1412 <nextcmd+0x2c2>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x32(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%rax
je     12de <nextcmd+0x18e>
movl   $0x1,-0x4(%rbp)
jmp    1483 <nextcmd+0x333>
movzbl -0x32(%rbp),%eax
cmp    $0x5b,%eax
je     12f8 <nextcmd+0x1a8>
movzbl -0x32(%rbp),%eax
cmp    $0x28,%eax
jne    13c4 <nextcmd+0x274>
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     1328 <nextcmd+0x1d8>
movl   $0x1,-0x4(%rbp)
jmp    1483 <nextcmd+0x333>
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     13b8 <nextcmd+0x268>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
je     13b3 <nextcmd+0x263>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
mov    -0x44(%rbp),%edx
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
lea    0xca2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1483 <nextcmd+0x333>
jmp    13b8 <nextcmd+0x268>
movl   $0x0,-0x4(%rbp)
jmp    1483 <nextcmd+0x333>
movzbl -0x32(%rbp),%eax
cmp    $0x40,%eax
jne    13ed <nextcmd+0x29d>
mov    0x2c08(%rip),%rax
mov    (%rax),%edi
lea    0xc8e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1408 <nextcmd+0x2b8>
mov    0x2bec(%rip),%rax
mov    (%rax),%edi
movzbl -0x32(%rbp),%edx
lea    0xc8c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    140d <nextcmd+0x2bd>
jmp    1472 <nextcmd+0x322>
movzbl -0x31(%rbp),%eax
cmp    $0xc,%eax
jne    143b <nextcmd+0x2eb>
mov    0x2bba(%rip),%rax
mov    (%rax),%edi
lea    0xc7e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    146d <nextcmd+0x31d>
mov    0x2b9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
movzbl -0x31(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <ftell@plt>
mov    -0x4c(%rbp),%edi
mov    -0x48(%rbp),%edx
mov    %eax,%ecx
lea    0xc55(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1472 <nextcmd+0x322>
jmp    1477 <nextcmd+0x327>
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    $0x2a8,%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    $0x107,%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
%17 = 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
%18 = load i32*, i32** %7
%19 = call i64 @feof(i32* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %5
store i32 -1, i32* %6
br label %160
22: ; preds = %5
br label %23
23: ; preds = %158, %22
%24 = load i32*, i32** %7
%25 = call i64 @feof(i32* %24)
%26 = icmp ne i64 %25, 0
%27 = xor i1 %26, true
br i1 %27, label %28, label %159
28: ; preds = %23
%29 = load i32*, i32** %7
%30 = call zeroext i8 @fgetc(i32* %29)
store i8 %30, i8* %12
%31 = load i32*, i32** %7
%32 = call i64 @feof(i32* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %28
store i32 1, i32* %6
br label %160
35: ; preds = %28
%36 = load i8, i8* %12
%37 = zext i8 %36 to i32
%38 = icmp eq i32 %37, 60
br i1 %38, label %39, label %69
39: ; preds = %35
%40 = load i32*, i32** %11
%41 = load i32, i32* %40
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %53
43: ; preds = %39
store i32 680, i32* %14
%44 = load i8*, i8** %9
%45 = load i32*, i32** %7
%46 = call i32 @fread(i8* %44, i32 1, i32 679, i32* %45)
store i32 %46, i32* %16
%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 %68
53: ; preds = %39
%54 = load i32*, i32** %11
%55 = load i32, i32* %54
%56 = icmp eq i32 %55, 1
br i1 %56, label %57, label %67
57: ; preds = %53
store i32 263, i32* %15
%58 = load i8*, i8** %9
%59 = load i32*, i32** %7
%60 = call i32 @fread(i8* %58, i32 1, i32 262, i32* %59)
store i32 %60, i32* %16
%61 = load i32, i32* @stderr
%62 = load i32*, i32** %11
%63 = load i32, i32* %62
%64 = load i32, i32* %15
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %63, i32 %64)
%66 = load i32*, i32** %11
store i32 2, i32* %66
br label %67
67: ; preds = %57, %53
br label %68
68: ; preds = %67, %43
br label %158
69: ; preds = %35
%70 = load i8, i8* %12
%71 = zext i8 %70 to i32
%72 = icmp eq i32 %71, 27
br i1 %72, label %73, label %142
73: ; preds = %69
%74 = load i32*, i32** %7
%75 = call zeroext i8 @fgetc(i32* %74)
store i8 %75, i8* %13
%76 = load i32*, i32** %7
%77 = call i64 @feof(i32* %76)
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %73
store i32 1, i32* %6
br label %160
80: ; preds = %73
%81 = load i8, i8* %13
%82 = zext i8 %81 to i32
%83 = icmp eq i32 %82, 91
br i1 %83, label %88, label %84
84: ; preds = %80
%85 = load i8, i8* %13
%86 = zext i8 %85 to i32
%87 = icmp eq i32 %86, 40
br i1 %87, label %88, label %128
88: ; preds = %84, %80
%89 = load i32*, i32** %7
%90 = call zeroext i8 @fgetc(i32* %89)
%91 = load i8*, i8** %8
store i8 %90, i8* %91
%92 = load i32*, i32** %7
%93 = call i64 @feof(i32* %92)
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %96
95: ; preds = %88
store i32 1, i32* %6
br label %160
96: ; preds = %88
%97 = load i32*, i32** %7
%98 = call zeroext i8 @fgetc(i32* %97)
store i8 %98, i8* %12
%99 = load i32*, i32** %7
%100 = call zeroext i8 @fgetc(i32* %99)
store i8 %100, i8* %13
%101 = load i8, i8* %12
%102 = zext i8 %101 to i32
%103 = load i8, i8* %13
%104 = zext i8 %103 to i32
%105 = shl i32 %104, 8
%106 = add nsw i32 %102, %105
%107 = load i32*, i32** %10
store i32 %106, i32* %107
%108 = load i32*, i32** %10
%109 = load i32, i32* %108
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %127
111: ; preds = %96
%112 = load i8*, i8** %9
%113 = load i32*, i32** %10
%114 = load i32, i32* %113
%115 = load i32*, i32** %7
%116 = call i32 @fread(i8* %112, i32 1, i32 %114, i32* %115)
store i32 %116, i32* %17
%117 = load i32*, i32** %10
%118 = load i32, i32* %117
%119 = icmp ne i32 %116, %118
br i1 %119, label %120, label %126
120: ; preds = %111
%121 = load i32, i32* @stderr
%122 = load i32, i32* %17
%123 = load i32*, i32** %10
%124 = load i32, i32* %123
%125 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i32 %122, i32 %124)
store i32 -1, i32* %6
br label %160
126: ; preds = %111
br label %127
127: ; preds = %126, %96
store i32 0, i32* %6
br label %160
128: ; preds = %84
%129 = load i8, i8* %13
%130 = zext i8 %129 to i32
%131 = icmp eq i32 %130, 64
br i1 %131, label %132, label %135
132: ; preds = %128
%133 = load i32, i32* @stderr
%134 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
br label %140
135: ; preds = %128
%136 = load i32, i32* @stderr
%137 = load i8, i8* %13
%138 = zext i8 %137 to i32
%139 = call i32 (i32, i8*, ...) @fprintf(i32 %136, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i32 %138)
br label %140
140: ; preds = %135, %132
br label %141
141: ; preds = %140
br label %157
142: ; preds = %69
%143 = load i8, i8* %12
%144 = zext i8 %143 to i32
%145 = icmp eq i32 %144, 12
br i1 %145, label %146, label %149
146: ; preds = %142
%147 = load i32, i32* @stderr
%148 = call i32 (i32, i8*, ...) @fprintf(i32 %147, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %156
149: ; preds = %142
%150 = load i32, i32* @stderr
%151 = load i8, i8* %12
%152 = zext i8 %151 to i32
%153 = load i32*, i32** %7
%154 = call i32 @ftell(i32* %153)
%155 = call i32 (i32, i8*, ...) @fprintf(i32 %150, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i32 %152, i32 %154)
br label %156
156: ; preds = %149, %146
br label %157
157: ; preds = %156, %141
br label %158
158: ; preds = %157, %68
br label %23
159: ; preds = %23
store i32 -1, i32* %6
br label %160
160: ; preds = %159, %127, %120, %95, %79, %34, %21
%161 = load i32, i32* %6
ret i32 %161
}

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 680)
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 263)
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
}