#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 */
long evaleq();
int /*<<< orphan*/ look(char *);
scalar_t__ test(char *);
long evalband() {
  long val;
  for (val = evaleq(); !look("&&") && test("&");)
    val = val & evaleq();
  return (val);
}


x86 assembly (clang, -O0):
<evalband>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <evaleq@plt>
mov    %rax,-0x8(%rbp)
lea    0xeb6(%rip),%rdi
call   1040 <look@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
jne    1175 <evalband+0x45>
lea    0xe9b(%rip),%rdi
call   1050 <test@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1185 <evalband+0x55>
jmp    11a7 <evalband+0x77>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <evaleq@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
and    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1143 <evalband+0x13>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evalband>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <evaleq@plt>
mov    %rax,%rbx
lea    0xeba(%rip),%rdi
call   1040 <look@plt>
test   %eax,%eax
jne    1183 <evalband+0x53>
lea    0xeab(%rip),%r14
lea    0xea3(%rip),%r15
nopl   (%rax)
mov    %r14,%rdi
call   1050 <test@plt>
test   %rax,%rax
je     1183 <evalband+0x53>
xor    %eax,%eax
call   1030 <evaleq@plt>
and    %rax,%rbx
mov    %r15,%rdi
call   1040 <look@plt>
test   %eax,%eax
je     1160 <evalband+0x30>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"&&\00"
@.str.1 = [2 x i8] c"&\00"
define i64 @evalband() {
%1 = alloca i64
%2 = call i64 (...) @evaleq()
store i64 %2, i64* %1
br label %3
3: ; preds = %11, %0
%4 = call i32 @look(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = call i64 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br label %9
9: ; preds = %6, %3
%10 = phi i1 [ false, %3 ], [ %8, %6 ]
br i1 %10, label %11, label %15
11: ; preds = %9
%12 = load i64, i64* %1
%13 = call i64 (...) @evaleq()
%14 = and i64 %12, %13
store i64 %14, i64* %1
br label %3
15: ; preds = %9
%16 = load i64, i64* %1
ret i64 %16
}

LLVM IR (-O2):
@.str = [3 x i8] c"&&\00"
@.str.1 = [2 x i8] c"&\00"
define i64 @evalband() {
%1 = tail call i64 (...) @evaleq()
%2 = tail call i32 @look(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %0, %8
%5 = phi i64 [ %10, %8 ], [ %1, %0 ]
%6 = tail call i64 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = tail call i64 (...) @evaleq()
%10 = and i64 %9, %5
%11 = tail call i32 @look(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %4, label %13
13: ; preds = %4, %8, %0
%14 = phi i64 [ %1, %0 ], [ %10, %8 ], [ %5, %4 ]
ret i64 %14
}