#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 */

/* Variables and functions */
int execITerm(char **, unsigned char *, char, char *, char *);
int nextToken(char **, char **, int *);
int /*<<< orphan*/ pushBack(char **, int);
int execIExpression(char **str, unsigned char *bInPtr, char bitpos, char *pPtr,
                    char *err) {
  int f = 1;
  int term1, term2;
  int op;
  char *item;
  unsigned char bPtr[10];
  int n;
  for (n = 0; n <= 9; n++)
    bPtr[n] = *bInPtr++;
  op = -100;
  switch (nextToken(str, &item, &n)) {
  case 100:
    op = 100;
    break;
  case 101:
    op = 101;
    break;
  case 400:
    op = 400;
    break;
  default:
    pushBack(str, n);
    break;
  }
  if (op == 101)
    term1 = execITerm(str, bPtr, bitpos, pPtr, err) * (-1);
  else if (op == 400)
    term1 = ~(execITerm(str, bPtr, bitpos, pPtr, err));
  else
    term1 = execITerm(str, bPtr, bitpos, pPtr, err);
  if (*err) {
    return (0);
  }
  int t;
  op = -100;
  while ((t = nextToken(str, &item, &n)) != 0) {
    f = 1;
    switch (t) {
    case 100:
      op = 100;
      break;
    case 101:
      op = 101;
      break;
    case 400:
      op = 400;
      break;
    default:
      pushBack(str, n);
      return (term1);
    }
    if (op == 101)
      term2 = execITerm(str, bPtr, bitpos, pPtr, err) * (-1);
    else if (op == 400)
      term2 = ~(execITerm(str, bPtr, bitpos, pPtr, err));
    else if (op == 100)
      term2 = execITerm(str, bPtr, bitpos, pPtr, err);
    if (*err) {
      return (0);
    }
    term1 += term2;
  }
  return (term1);
}


x86 assembly (clang, -O0):
<execIExpression>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movl   $0x1,-0x34(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x9,-0x58(%rbp)
jg     118c <execIExpression+0x5c>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
movslq -0x58(%rbp),%rax
mov    %cl,-0x52(%rbp,%rax,1)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    115b <execIExpression+0x2b>
movl   $0xffffff9c,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x48(%rbp),%rsi
lea    -0x58(%rbp),%rdx
call   1050 <nextToken@plt>
mov    %eax,%ecx
mov    %ecx,-0x60(%rbp)
sub    $0x64,%eax
je     11db <execIExpression+0xab>
jmp    11b7 <execIExpression+0x87>
mov    -0x60(%rbp),%eax
sub    $0x65,%eax
je     11e7 <execIExpression+0xb7>
jmp    11c8 <execIExpression+0x98>
mov    -0x60(%rbp),%eax
sub    $0x190,%eax
je     11f3 <execIExpression+0xc3>
jmp    11ff <execIExpression+0xcf>
movl   $0x64,-0x40(%rbp)
jmp    120b <execIExpression+0xdb>
movl   $0x65,-0x40(%rbp)
jmp    120b <execIExpression+0xdb>
movl   $0x190,-0x40(%rbp)
jmp    120b <execIExpression+0xdb>
mov    -0x10(%rbp),%rdi
mov    -0x58(%rbp),%esi
call   1040 <pushBack@plt>
cmpl   $0x65,-0x40(%rbp)
jne    123b <execIExpression+0x10b>
mov    -0x10(%rbp),%rdi
lea    -0x52(%rbp),%rsi
mov    -0x19(%rbp),%al
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
movsbl %al,%edx
call   1030 <execITerm@plt>
imul   $0xffffffff,%eax,%eax
mov    %eax,-0x38(%rbp)
jmp    1291 <execIExpression+0x161>
cmpl   $0x190,-0x40(%rbp)
jne    126e <execIExpression+0x13e>
mov    -0x10(%rbp),%rdi
lea    -0x52(%rbp),%rsi
mov    -0x19(%rbp),%al
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
movsbl %al,%edx
call   1030 <execITerm@plt>
xor    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
jmp    128c <execIExpression+0x15c>
mov    -0x10(%rbp),%rdi
lea    -0x52(%rbp),%rsi
mov    -0x19(%rbp),%al
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
movsbl %al,%edx
call   1030 <execITerm@plt>
mov    %eax,-0x38(%rbp)
jmp    1291 <execIExpression+0x161>
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     12aa <execIExpression+0x17a>
movl   $0x0,-0x4(%rbp)
jmp    140a <execIExpression+0x2da>
movl   $0xffffff9c,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x48(%rbp),%rsi
lea    -0x58(%rbp),%rdx
call   1050 <nextToken@plt>
mov    %eax,-0x5c(%rbp)
cmp    $0x0,%eax
je     1404 <execIExpression+0x2d4>
movl   $0x1,-0x34(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x64(%rbp)
sub    $0x64,%eax
je     130d <execIExpression+0x1dd>
jmp    12e9 <execIExpression+0x1b9>
mov    -0x64(%rbp),%eax
sub    $0x65,%eax
je     1319 <execIExpression+0x1e9>
jmp    12fa <execIExpression+0x1ca>
mov    -0x64(%rbp),%eax
sub    $0x190,%eax
je     1325 <execIExpression+0x1f5>
jmp    1331 <execIExpression+0x201>
movl   $0x64,-0x40(%rbp)
jmp    1348 <execIExpression+0x218>
movl   $0x65,-0x40(%rbp)
jmp    1348 <execIExpression+0x218>
movl   $0x190,-0x40(%rbp)
jmp    1348 <execIExpression+0x218>
mov    -0x10(%rbp),%rdi
mov    -0x58(%rbp),%esi
call   1040 <pushBack@plt>
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    140a <execIExpression+0x2da>
cmpl   $0x65,-0x40(%rbp)
jne    1378 <execIExpression+0x248>
mov    -0x10(%rbp),%rdi
lea    -0x52(%rbp),%rsi
mov    -0x19(%rbp),%al
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
movsbl %al,%edx
call   1030 <execITerm@plt>
imul   $0xffffffff,%eax,%eax
mov    %eax,-0x3c(%rbp)
jmp    13dd <execIExpression+0x2ad>
cmpl   $0x190,-0x40(%rbp)
jne    13ab <execIExpression+0x27b>
mov    -0x10(%rbp),%rdi
lea    -0x52(%rbp),%rsi
mov    -0x19(%rbp),%al
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
movsbl %al,%edx
call   1030 <execITerm@plt>
xor    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
jmp    13d8 <execIExpression+0x2a8>
cmpl   $0x64,-0x40(%rbp)
jne    13d3 <execIExpression+0x2a3>
mov    -0x10(%rbp),%rdi
lea    -0x52(%rbp),%rsi
mov    -0x19(%rbp),%al
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
movsbl %al,%edx
call   1030 <execITerm@plt>
mov    %eax,-0x3c(%rbp)
jmp    13d8 <execIExpression+0x2a8>
jmp    13dd <execIExpression+0x2ad>
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     13f6 <execIExpression+0x2c6>
movl   $0x0,-0x4(%rbp)
jmp    140a <execIExpression+0x2da>
mov    -0x3c(%rbp),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    12b1 <execIExpression+0x181>
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execIExpression>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r14
mov    %rcx,%r15
mov    %edx,%r12d
mov    %rdi,%rbx
mov    (%rsi),%rax
mov    %rax,0x10(%rsp)
movzwl 0x8(%rsi),%eax
mov    %ax,0x18(%rsp)
movl   $0xa,0xc(%rsp)
lea    0x20(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1050 <nextToken@plt>
cmp    $0x64,%eax
je     11d5 <execIExpression+0xa5>
cmp    $0x65,%eax
je     11a6 <execIExpression+0x76>
cmp    $0x190,%eax
jne    11c9 <execIExpression+0x99>
movsbl %r12b,%edx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <execITerm@plt>
mov    %eax,%ebp
not    %ebp
cmpb   $0x0,(%r14)
jne    11f4 <execIExpression+0xc4>
jmp    1207 <execIExpression+0xd7>
movsbl %r12b,%edx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <execITerm@plt>
mov    %eax,%ebp
neg    %ebp
cmpb   $0x0,(%r14)
jne    11f4 <execIExpression+0xc4>
jmp    1207 <execIExpression+0xd7>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <pushBack@plt>
movsbl %r12b,%edx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <execITerm@plt>
mov    %eax,%ebp
cmpb   $0x0,(%r14)
je     1207 <execIExpression+0xd7>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movsbl %r12b,%r13d
lea    0x10(%rsp),%r12
jmp    123e <execIExpression+0x10e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13d,%edx
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <execITerm@plt>
neg    %eax
add    %eax,%ebp
cmpb   $0x0,(%r14)
jne    11f4 <execIExpression+0xc4>
mov    %rbx,%rdi
lea    0x20(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1050 <nextToken@plt>
cmp    $0x64,%eax
jle    1280 <execIExpression+0x150>
cmp    $0x65,%eax
je     1220 <execIExpression+0xf0>
cmp    $0x190,%eax
jne    12a0 <execIExpression+0x170>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13d,%edx
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <execITerm@plt>
not    %eax
jmp    1236 <execIExpression+0x106>
nopl   0x0(%rax)
jne    1298 <execIExpression+0x168>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13d,%edx
mov    %r15,%rcx
mov    %r14,%r8
call   1030 <execITerm@plt>
jmp    1236 <execIExpression+0x106>
test   %eax,%eax
je     11f6 <execIExpression+0xc6>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <pushBack@plt>
jmp    11f6 <execIExpression+0xc6>

LLVM IR (-O0):
define i32 @execIExpression(i8** %0, i8* %1, i8 signext %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i8
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca [10 x i8]
%18 = alloca i32
%19 = alloca i32
store i8** %0, i8*** %7
store i8* %1, i8** %8
store i8 %2, i8* %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i32 1, i32* %12
store i32 0, i32* %18
br label %20
20: ; preds = %30, %5
%21 = load i32, i32* %18
%22 = icmp sle i32 %21, 9
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i8*, i8** %8
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %8
%26 = load i8, i8* %24
%27 = load i32, i32* %18
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 %28
store i8 %26, i8* %29
br label %30
30: ; preds = %23
%31 = load i32, i32* %18
%32 = add nsw i32 %31, 1
store i32 %32, i32* %18
br label %20
33: ; preds = %20
store i32 -100, i32* %15
%34 = load i8**, i8*** %7
%35 = call i32 @nextToken(i8** %34, i8** %16, i32* %18)
switch i32 %35, label %39 [
i32 100, label %36
i32 101, label %37
i32 400, label %38
]
36: ; preds = %33
store i32 100, i32* %15
br label %43
37: ; preds = %33
store i32 101, i32* %15
br label %43
38: ; preds = %33
store i32 400, i32* %15
br label %43
39: ; preds = %33
%40 = load i8**, i8*** %7
%41 = load i32, i32* %18
%42 = call i32 @pushBack(i8** %40, i32 %41)
br label %43
43: ; preds = %39, %38, %37, %36
%44 = load i32, i32* %15
%45 = icmp eq i32 %44, 101
br i1 %45, label %46, label %54
46: ; preds = %43
%47 = load i8**, i8*** %7
%48 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%49 = load i8, i8* %9
%50 = load i8*, i8** %10
%51 = load i8*, i8** %11
%52 = call i32 @execITerm(i8** %47, i8* %48, i8 signext %49, i8* %50, i8* %51)
%53 = mul nsw i32 %52, -1
store i32 %53, i32* %13
br label %73
54: ; preds = %43
%55 = load i32, i32* %15
%56 = icmp eq i32 %55, 400
br i1 %56, label %57, label %65
57: ; preds = %54
%58 = load i8**, i8*** %7
%59 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%60 = load i8, i8* %9
%61 = load i8*, i8** %10
%62 = load i8*, i8** %11
%63 = call i32 @execITerm(i8** %58, i8* %59, i8 signext %60, i8* %61, i8* %62)
%64 = xor i32 %63, -1
store i32 %64, i32* %13
br label %72
65: ; preds = %54
%66 = load i8**, i8*** %7
%67 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%68 = load i8, i8* %9
%69 = load i8*, i8** %10
%70 = load i8*, i8** %11
%71 = call i32 @execITerm(i8** %66, i8* %67, i8 signext %68, i8* %69, i8* %70)
store i32 %71, i32* %13
br label %72
72: ; preds = %65, %57
br label %73
73: ; preds = %72, %46
%74 = load i8*, i8** %11
%75 = load i8, i8* %74
%76 = icmp ne i8 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %73
store i32 0, i32* %6
br label %138
78: ; preds = %73
store i32 -100, i32* %15
br label %79
79: ; preds = %132, %78
%80 = load i8**, i8*** %7
%81 = call i32 @nextToken(i8** %80, i8** %16, i32* %18)
store i32 %81, i32* %19
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %136
83: ; preds = %79
store i32 1, i32* %12
%84 = load i32, i32* %19
switch i32 %84, label %88 [
i32 100, label %85
i32 101, label %86
i32 400, label %87
]
85: ; preds = %83
store i32 100, i32* %15
br label %93
86: ; preds = %83
store i32 101, i32* %15
br label %93
87: ; preds = %83
store i32 400, i32* %15
br label %93
88: ; preds = %83
%89 = load i8**, i8*** %7
%90 = load i32, i32* %18
%91 = call i32 @pushBack(i8** %89, i32 %90)
%92 = load i32, i32* %13
store i32 %92, i32* %6
br label %138
93: ; preds = %87, %86, %85
%94 = load i32, i32* %15
%95 = icmp eq i32 %94, 101
br i1 %95, label %96, label %104
96: ; preds = %93
%97 = load i8**, i8*** %7
%98 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%99 = load i8, i8* %9
%100 = load i8*, i8** %10
%101 = load i8*, i8** %11
%102 = call i32 @execITerm(i8** %97, i8* %98, i8 signext %99, i8* %100, i8* %101)
%103 = mul nsw i32 %102, -1
store i32 %103, i32* %14
br label %127
104: ; preds = %93
%105 = load i32, i32* %15
%106 = icmp eq i32 %105, 400
br i1 %106, label %107, label %115
107: ; preds = %104
%108 = load i8**, i8*** %7
%109 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%110 = load i8, i8* %9
%111 = load i8*, i8** %10
%112 = load i8*, i8** %11
%113 = call i32 @execITerm(i8** %108, i8* %109, i8 signext %110, i8* %111, i8* %112)
%114 = xor i32 %113, -1
store i32 %114, i32* %14
br label %126
115: ; preds = %104
%116 = load i32, i32* %15
%117 = icmp eq i32 %116, 100
br i1 %117, label %118, label %125
118: ; preds = %115
%119 = load i8**, i8*** %7
%120 = getelementptr inbounds [10 x i8], [10 x i8]* %17, i64 0, i64 0
%121 = load i8, i8* %9
%122 = load i8*, i8** %10
%123 = load i8*, i8** %11
%124 = call i32 @execITerm(i8** %119, i8* %120, i8 signext %121, i8* %122, i8* %123)
store i32 %124, i32* %14
br label %125
125: ; preds = %118, %115
br label %126
126: ; preds = %125, %107
br label %127
127: ; preds = %126, %96
%128 = load i8*, i8** %11
%129 = load i8, i8* %128
%130 = icmp ne i8 %129, 0
br i1 %130, label %131, label %132
131: ; preds = %127
store i32 0, i32* %6
br label %138
132: ; preds = %127
%133 = load i32, i32* %14
%134 = load i32, i32* %13
%135 = add nsw i32 %134, %133
store i32 %135, i32* %13
br label %79
136: ; preds = %79
%137 = load i32, i32* %13
store i32 %137, i32* %6
br label %138
138: ; preds = %136, %131, %88, %77
%139 = load i32, i32* %6
ret i32 %139
}

LLVM IR (-O2):
define i32 @execIExpression(i8** %0, i8* nocapture %1, i8 signext %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca [10 x i8]
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%9 = alloca i32
%10 = bitcast i8** %6 to i8*
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%12 = bitcast i32* %9 to i8*
store i32 10, i32* %9
%13 = call i32 @nextToken(i8** %0, i8** %6, i32* %9)
switch i32 %13, label %14 [
i32 100, label %23
i32 101, label %17
i32 400, label %20
]
14: ; preds = %5
%15 = load i32, i32* %9
%16 = call i32 @pushBack(i8** %0, i32 %15)
br label %23
17: ; preds = %5
%18 = call i32 @execITerm(i8** %0, i8* %11, i8 signext %2, i8* %3, i8* %4)
%19 = sub nsw i32 0, %18
br label %25
20: ; preds = %5
%21 = call i32 @execITerm(i8** %0, i8* %11, i8 signext %2, i8* %3, i8* %4)
%22 = xor i32 %21, -1
br label %25
23: ; preds = %5, %14
%24 = call i32 @execITerm(i8** %0, i8* %11, i8 signext %2, i8* %3, i8* %4)
br label %25
25: ; preds = %20, %23, %17
%26 = phi i32 [ %19, %17 ], [ %22, %20 ], [ %24, %23 ]
%27 = load i8, i8* %4
%28 = icmp eq i8 %27, 0
br i1 %28, label %29, label %48
29: ; preds = %25, %43
%30 = phi i32 [ %47, %43 ], [ %26, %25 ]
%31 = call i32 @nextToken(i8** %0, i8** %6, i32* %9)
switch i32 %31, label %32 [
i32 0, label %48
i32 100, label %41
i32 101, label %35
i32 400, label %38
]
32: ; preds = %29
%33 = load i32, i32* %9
%34 = call i32 @pushBack(i8** %0, i32 %33)
br label %48
35: ; preds = %29
%36 = call i32 @execITerm(i8** %0, i8* %11, i8 signext %2, i8* %3, i8* %4)
%37 = sub nsw i32 0, %36
br label %43
38: ; preds = %29
%39 = call i32 @execITerm(i8** %0, i8* %11, i8 signext %2, i8* %3, i8* %4)
%40 = xor i32 %39, -1
br label %43
41: ; preds = %29
%42 = call i32 @execITerm(i8** %0, i8* %11, i8 signext %2, i8* %3, i8* %4)
br label %43
43: ; preds = %38, %41, %35
%44 = phi i32 [ %37, %35 ], [ %40, %38 ], [ %42, %41 ]
%45 = load i8, i8* %4
%46 = icmp eq i8 %45, 0
%47 = add nsw i32 %44, %30
br i1 %46, label %29, label %48
48: ; preds = %43, %29, %32, %25
%49 = phi i32 [ 0, %25 ], [ %30, %32 ], [ %30, %29 ], [ 0, %43 ]
ret i32 %49
}