#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 */
struct instruction {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ append_error();
int /*<<< orphan*/ append_eval_op(struct instruction *, char *, char *,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ newline(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void parse_instruction(struct instruction *instr, FILE *f) {
  int c;
  char left_tok[64] = "", right_tok[64] = "";
  int left_tok_i = 0, right_tok_i = 0;
  while (true) {
    c = fgetc(f);
    if (c == ',') {
      if (true)
        break;
      else {
        fprintf(stderr, "Error: Right operand unexpected.\n");
        exit(1);
      }
    }
    if (newline(c, f)) {
      if (true) {
        fprintf(stderr, "Error: Right operand expected.\n");
        exit(1);
      } else
        break;
    }
    {
      left_tok[left_tok_i++] = c;
      if (left_tok_i >= 64 - 1)
        append_error();
      left_tok[left_tok_i] = '\0';
    };
  }
  if (true)
    while (true) {
      c = fgetc(f);
      if (c == ',') {
        fprintf(stderr, "Error: Third operand unexpected.\n");
        exit(1);
      }
      if (newline(c, f))
        break;
      {
        right_tok[right_tok_i++] = c;
        if (right_tok_i >= 64 - 1)
          append_error();
        right_tok[right_tok_i] = '\0';
      };
    }
  append_eval_op(instr, left_tok, right_tok, 0);
}


x86 assembly (clang, -O0):
<parse_instruction>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
movl   $0x0,-0xa4(%rbp)
movl   $0x0,-0xa8(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x2c,-0x14(%rbp)
jne    11d5 <parse_instruction+0x65>
jmp    124b <parse_instruction+0xdb>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <newline@plt>
cmp    $0x0,%rax
je     120a <parse_instruction+0x9a>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xe05(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0xa4(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xa4(%rbp)
cltq
mov    %cl,-0x60(%rbp,%rax,1)
cmpl   $0x3f,-0xa4(%rbp)
jl     123a <parse_instruction+0xca>
mov    $0x0,%al
call   1060 <append_error@plt>
movslq -0xa4(%rbp),%rax
movb   $0x0,-0x60(%rbp,%rax,1)
jmp    11ba <parse_instruction+0x4a>
jmp    1250 <parse_instruction+0xe0>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x2c,-0x14(%rbp)
jne    1285 <parse_instruction+0x115>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
lea    0xdaa(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <newline@plt>
cmp    $0x0,%rax
je     12a0 <parse_instruction+0x130>
jmp    12e7 <parse_instruction+0x177>
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0xa8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xa8(%rbp)
cltq
mov    %cl,-0xa0(%rbp,%rax,1)
cmpl   $0x3f,-0xa8(%rbp)
jl     12d3 <parse_instruction+0x163>
mov    $0x0,%al
call   1060 <append_error@plt>
movslq -0xa8(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
jmp    1250 <parse_instruction+0xe0>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
xor    %ecx,%ecx
call   1080 <append_eval_op@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_instruction>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsi,%rdi
call   1040 <fgetc@plt>
cmp    $0x2c,%eax
jne    122e <parse_instruction+0xce>
mov    %r15,%rdi
call   1040 <fgetc@plt>
cmp    $0x2c,%eax
je     127f <parse_instruction+0x11f>
mov    %eax,%ebp
xor    %ebx,%ebx
jmp    11ec <parse_instruction+0x8c>
cs nopw 0x0(%rax,%rax,1)
nop
movb   $0x0,0x1(%rsp,%rbx,1)
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebp
add    $0x1,%rbx
cmp    $0x2c,%eax
je     127f <parse_instruction+0x11f>
mov    %ebp,%edi
mov    %r15,%rsi
call   1030 <newline@plt>
test   %rax,%rax
jne    120e <parse_instruction+0xae>
mov    %bpl,(%rsp,%rbx,1)
cmp    $0x3e,%rbx
jb     11d0 <parse_instruction+0x70>
xor    %eax,%eax
call   1050 <append_error@plt>
jmp    11d0 <parse_instruction+0x70>
lea    0x40(%rsp),%rsi
mov    %rsp,%rdx
mov    %r14,%rdi
xor    %ecx,%ecx
call   1070 <append_eval_op@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
xor    %ebx,%ebx
jmp    125c <parse_instruction+0xfc>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movb   $0x0,0x41(%rsp,%rbx,1)
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebp
add    $0x1,%rbx
cmp    $0x2c,%eax
je     11ae <parse_instruction+0x4e>
mov    %ebp,%edi
mov    %r15,%rsi
call   1030 <newline@plt>
test   %rax,%rax
jne    1291 <parse_instruction+0x131>
mov    %bpl,0x40(%rsp,%rbx,1)
cmp    $0x3e,%rbx
jb     1240 <parse_instruction+0xe0>
xor    %eax,%eax
call   1050 <append_error@plt>
jmp    1240 <parse_instruction+0xe0>
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
lea    0xd91(%rip),%rsi
jmp    12a1 <parse_instruction+0x141>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
lea    0xd5f(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.instruction = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"Error: Right operand expected.\0A\00"
@.str.1 = [34 x i8] c"Error: Third operand unexpected.\0A\00"
define void @parse_instruction(%struct.instruction* %0, i32* %1) {
%3 = alloca %struct.instruction*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [64 x i8]
%7 = alloca [64 x i8]
%8 = alloca i32
%9 = alloca i32
store %struct.instruction* %0, %struct.instruction** %3
store i32* %1, i32** %4
%10 = bitcast [64 x i8]* %6 to i8*
%11 = bitcast [64 x i8]* %7 to i8*
store i32 0, i32* %8
store i32 0, i32* %9
br label %12
12: ; preds = %2, %38
%13 = load i32*, i32** %4
%14 = call i32 @fgetc(i32* %13)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 44
br i1 %16, label %17, label %18
17: ; preds = %12
br label %42
18: ; preds = %12
%19 = load i32, i32* %5
%20 = load i32*, i32** %4
%21 = call i64 @newline(i32 %19, i32* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %18
%28 = load i32, i32* %5
%29 = trunc i32 %28 to i8
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
%32 = sext i32 %30 to i64
%33 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 %32
store i8 %29, i8* %33
%34 = load i32, i32* %8
%35 = icmp sge i32 %34, 63
br i1 %35, label %36, label %38
36: ; preds = %27
%37 = call i32 (...) @append_error()
br label %38
38: ; preds = %36, %27
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 %40
store i8 0, i8* %41
br label %12
42: ; preds = %17
br label %43
43: ; preds = %42, %69
%44 = load i32*, i32** %4
%45 = call i32 @fgetc(i32* %44)
store i32 %45, i32* %5
%46 = load i32, i32* %5
%47 = icmp eq i32 %46, 44
br i1 %47, label %48, label %52
48: ; preds = %43
%49 = load i32, i32* @stderr
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%51 = call i32 @exit(i32 1)
unreachable
52: ; preds = %43
%53 = load i32, i32* %5
%54 = load i32*, i32** %4
%55 = call i64 @newline(i32 %53, i32* %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %52
br label %73
58: ; preds = %52
%59 = load i32, i32* %5
%60 = trunc i32 %59 to i8
%61 = load i32, i32* %9
%62 = add nsw i32 %61, 1
store i32 %62, i32* %9
%63 = sext i32 %61 to i64
%64 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 %63
store i8 %60, i8* %64
%65 = load i32, i32* %9
%66 = icmp sge i32 %65, 63
br i1 %66, label %67, label %69
67: ; preds = %58
%68 = call i32 (...) @append_error()
br label %69
69: ; preds = %67, %58
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 %71
store i8 0, i8* %72
br label %43
73: ; preds = %57
%74 = load %struct.instruction*, %struct.instruction** %3
%75 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%76 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%77 = call i32 @append_eval_op(%struct.instruction* %74, i8* %75, i8* %76, i32 0)
ret void
}

LLVM IR (-O2):
%struct.instruction = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"Error: Right operand expected.\0A\00"
@.str.1 = [34 x i8] c"Error: Third operand unexpected.\0A\00"
define void @parse_instruction(%struct.instruction* %0, i32* %1) {
%3 = alloca [64 x i8]
%4 = alloca [64 x i8]
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @fgetc(i32* %1)
%8 = icmp eq i32 %7, 44
br i1 %8, label %9, label %12
9: ; preds = %28, %2
%10 = tail call i32 @fgetc(i32* %1)
%11 = icmp eq i32 %10, 44
br i1 %11, label %32, label %36
12: ; preds = %2, %28
%13 = phi i64 [ %23, %28 ], [ 0, %2 ]
%14 = phi i32 [ %30, %28 ], [ %7, %2 ]
%15 = tail call i64 @newline(i32 %14, i32* %1)
%16 = icmp eq i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%20 = tail call i32 @exit(i32 1)
unreachable
21: ; preds = %12
%22 = trunc i32 %14 to i8
%23 = add nuw i64 %13, 1
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 %13
store i8 %22, i8* %24
%25 = icmp ugt i64 %13, 61
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = tail call i32 (...) @append_error()
br label %28
28: ; preds = %26, %21
%29 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 %23
store i8 0, i8* %29
%30 = tail call i32 @fgetc(i32* %1)
%31 = icmp eq i32 %30, 44
br i1 %31, label %9, label %12
32: ; preds = %48, %9
%33 = load i32, i32* @stderr
%34 = tail call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%35 = tail call i32 @exit(i32 1)
unreachable
36: ; preds = %9, %48
%37 = phi i64 [ %43, %48 ], [ 0, %9 ]
%38 = phi i32 [ %50, %48 ], [ %10, %9 ]
%39 = tail call i64 @newline(i32 %38, i32* %1)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %52
41: ; preds = %36
%42 = trunc i32 %38 to i8
%43 = add nuw i64 %37, 1
%44 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 %37
store i8 %42, i8* %44
%45 = icmp ugt i64 %37, 61
br i1 %45, label %46, label %48
46: ; preds = %41
%47 = tail call i32 (...) @append_error()
br label %48
48: ; preds = %46, %41
%49 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 %43
store i8 0, i8* %49
%50 = tail call i32 @fgetc(i32* %1)
%51 = icmp eq i32 %50, 44
br i1 %51, label %32, label %36
52: ; preds = %36
%53 = call i32 @append_eval_op(%struct.instruction* %0, i8* %5, i8* %6, i32 0)
ret void
}