#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 */
float ComputeLogic(float, float, char *);
int GetElement(char *, char *, int);
float atof(char *);
int ResolveLevelOne(char *LogicString) {
  int i, j, Start = 0;
  float Response, Value;
  static char Token[5] = "", Operator[5] = "";
  for (i = 0; LogicString[i] != '\x00'; i++) {
    if ((LogicString[i] == '(') || (LogicString[i] == ')')) {
      for (j = i; LogicString[j] != '\x00'; j++)
        LogicString[j] = LogicString[j + 1];
    }
  }
  Start = GetElement(LogicString, Token, Start);
  Value = atof(Token);
  Response = (Value == 0) ? 0 : 1;
  while (LogicString[Start] != '\x00') {
    Start = GetElement(LogicString, Operator, Start);
    Start = GetElement(LogicString, Token, Start);
    Value = atof(Token);
    Response = ComputeLogic((float)Response, (float)Value, Operator);
  }
  return ((int)Response);
}


x86 assembly (clang, -O0):
<ResolveLevelOne>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11e5 <ResolveLevelOne+0xb5>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x28,%eax
je     1189 <ResolveLevelOne+0x59>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x29,%eax
jne    11d2 <ResolveLevelOne+0xa2>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11cd <ResolveLevelOne+0x9d>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118f <ResolveLevelOne+0x5f>
jmp    11d2 <ResolveLevelOne+0xa2>
jmp    11d7 <ResolveLevelOne+0xa7>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114a <ResolveLevelOne+0x1a>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0x2e46(%rip),%rsi
call   1040 <GetElement@plt>
mov    %eax,-0x14(%rbp)
lea    0x2e37(%rip),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
xorps  %xmm1,%xmm1
mov    $0x1,%eax
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
setnp  %sil
sete   %dl
test   %sil,%dl
cmovne %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     12a6 <ResolveLevelOne+0x176>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0x2de7(%rip),%rsi
call   1040 <GetElement@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0x2dcc(%rip),%rsi
call   1040 <GetElement@plt>
mov    %eax,-0x14(%rbp)
lea    0x2dbd(%rip),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
lea    0x2da7(%rip),%rdi
call   1050 <ComputeLogic@plt>
movss  %xmm0,-0x18(%rbp)
jmp    1234 <ResolveLevelOne+0x104>
cvttss2si -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ResolveLevelOne>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r12
lea    0x1(%rdi),%rax
xor    %ecx,%ecx
jmp    115c <ResolveLevelOne+0x2c>
nopw   0x0(%rax,%rax,1)
test   %dl,%dl
je     1180 <ResolveLevelOne+0x50>
add    $0x1,%rcx
add    $0x1,%rax
mov    (%r12,%rcx,1),%dl
lea    -0x28(%rdx),%esi
cmp    $0x2,%sil
jae    1150 <ResolveLevelOne+0x20>
mov    %rax,%rdx
nopl   0x0(%rax)
movzbl (%rdx),%ebx
mov    %bl,-0x1(%rdx)
add    $0x1,%rdx
test   %bl,%bl
jne    1170 <ResolveLevelOne+0x40>
jmp    1154 <ResolveLevelOne+0x24>
lea    0x2eb2(%rip),%r14
mov    %r12,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <GetElement@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <atof@plt>
xorps  %xmm1,%xmm1
cmpneqss %xmm0,%xmm1
movss  0xe52(%rip),%xmm0
andps  %xmm1,%xmm0
movslq %ebp,%rax
cmpb   $0x0,(%r12,%rax,1)
je     1211 <ResolveLevelOne+0xe1>
lea    0x2e7c(%rip),%r14
lea    0x2e70(%rip),%r15
nopl   0x0(%rax)
movaps %xmm0,(%rsp)
mov    %r12,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <GetElement@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1040 <GetElement@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <atof@plt>
movaps %xmm0,%xmm1
movaps (%rsp),%xmm0
mov    %r14,%rdi
call   1050 <ComputeLogic@plt>
movslq %ebp,%rax
cmpb   $0x0,(%r12,%rax,1)
jne    11d0 <ResolveLevelOne+0xa0>
cvttss2si %xmm0,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@ResolveLevelOne.Token = internal global [5 x i8] zeroinitializer
@ResolveLevelOne.Operator = internal global [5 x i8] zeroinitializer
define i32 @ResolveLevelOne(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store i8* %0, i8** %2
store i32 0, i32* %5
store i32 0, i32* %3
br label %8
8: ; preds = %58, %1
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %61
16: ; preds = %8
%17 = load i8*, i8** %2
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 40
br i1 %23, label %32, label %24
24: ; preds = %16
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 41
br i1 %31, label %32, label %57
32: ; preds = %24, %16
%33 = load i32, i32* %3
store i32 %33, i32* %4
br label %34
34: ; preds = %53, %32
%35 = load i8*, i8** %2
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %56
42: ; preds = %34
%43 = load i8*, i8** %2
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %43, i64 %46
%48 = load i8, i8* %47
%49 = load i8*, i8** %2
%50 = load i32, i32* %4
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
store i8 %48, i8* %52
br label %53
53: ; preds = %42
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %34
56: ; preds = %34
br label %57
57: ; preds = %56, %24
br label %58
58: ; preds = %57
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %8
61: ; preds = %8
%62 = load i8*, i8** %2
%63 = load i32, i32* %5
%64 = call i32 @GetElement(i8* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Token, i64 0, i64 0), i32 %63)
store i32 %64, i32* %5
%65 = call float @atof(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Token, i64 0, i64 0))
store float %65, float* %7
%66 = load float, float* %7
%67 = fcmp oeq float %66, 0.000000e+00
%68 = zext i1 %67 to i64
%69 = select i1 %67, i32 0, i32 1
%70 = sitofp i32 %69 to float
store float %70, float* %6
br label %71
71: ; preds = %79, %61
%72 = load i8*, i8** %2
%73 = load i32, i32* %5
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %72, i64 %74
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %90
79: ; preds = %71
%80 = load i8*, i8** %2
%81 = load i32, i32* %5
%82 = call i32 @GetElement(i8* %80, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Operator, i64 0, i64 0), i32 %81)
store i32 %82, i32* %5
%83 = load i8*, i8** %2
%84 = load i32, i32* %5
%85 = call i32 @GetElement(i8* %83, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Token, i64 0, i64 0), i32 %84)
store i32 %85, i32* %5
%86 = call float @atof(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Token, i64 0, i64 0))
store float %86, float* %7
%87 = load float, float* %6
%88 = load float, float* %7
%89 = call float @ComputeLogic(float %87, float %88, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Operator, i64 0, i64 0))
store float %89, float* %6
br label %71
90: ; preds = %71
%91 = load float, float* %6
%92 = fptosi float %91 to i32
ret i32 %92
}

LLVM IR (-O2):
@ResolveLevelOne.Token = internal global [5 x i8] zeroinitializer
@ResolveLevelOne.Operator = internal global [5 x i8] zeroinitializer
define i32 @ResolveLevelOne(i8* %0) {
br label %2
2: ; preds = %15, %1
%3 = phi i64 [ %16, %15 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %15 [
i8 0, label %17
i8 40, label %6
i8 41, label %6
]
6: ; preds = %2, %2
br label %7
7: ; preds = %6, %7
%8 = phi i64 [ %10, %7 ], [ %3, %6 ]
%9 = phi i8* [ %11, %7 ], [ %4, %6 ]
%10 = add nuw i64 %8, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %9
%13 = load i8, i8* %11
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %7
15: ; preds = %7, %2
%16 = add nuw i64 %3, 1
br label %2
17: ; preds = %2
%18 = tail call i32 @GetElement(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Token, i64 0, i64 0), i32 0)
%19 = tail call float @atof(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Token, i64 0, i64 0))
%20 = fcmp une float %19, 0.000000e+00
%21 = uitofp i1 %20 to float
%22 = sext i32 %18 to i64
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %37, label %26
26: ; preds = %17, %26
%27 = phi float [ %32, %26 ], [ %21, %17 ]
%28 = phi i32 [ %30, %26 ], [ %18, %17 ]
%29 = tail call i32 @GetElement(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Operator, i64 0, i64 0), i32 %28)
%30 = tail call i32 @GetElement(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Token, i64 0, i64 0), i32 %29)
%31 = tail call float @atof(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Token, i64 0, i64 0))
%32 = tail call float @ComputeLogic(float %27, float %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @ResolveLevelOne.Operator, i64 0, i64 0))
%33 = sext i32 %30 to i64
%34 = getelementptr inbounds i8, i8* %0, i64 %33
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 0
br i1 %36, label %37, label %26
37: ; preds = %26, %17
%38 = phi float [ %21, %17 ], [ %32, %26 ]
%39 = fptosi float %38 to i32
ret i32 %39
}