#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 evalsh();
scalar_t__ test(char *);
long evalrel() {
  long val;
  for (val = evalsh();;) {
    if (test("<="))
      val = val <= evalsh();
    else if (test(">="))
      val = val >= evalsh();
    else if (test("<"))
      val = val < evalsh();
    else if (test(">"))
      val = val > evalsh();
    else
      break;
  }
  return (val);
}


x86 assembly (clang, -O0):
<evalrel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1030 <evalsh@plt>
mov    %rax,-0x8(%rbp)
lea    0xec6(%rip),%rdi
call   1040 <test@plt>
cmp    $0x0,%rax
je     1175 <evalrel+0x55>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <evalsh@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
setle  %al
and    $0x1,%al
movzbl %al,%eax
cltq
mov    %rax,-0x8(%rbp)
jmp    124f <evalrel+0x12f>
lea    0xe87(%rip),%rdi
call   1040 <test@plt>
cmp    $0x0,%rax
je     11b7 <evalrel+0x97>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <evalsh@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
cltq
mov    %rax,-0x8(%rbp)
jmp    124a <evalrel+0x12a>
lea    0xe48(%rip),%rdi
call   1040 <test@plt>
cmp    $0x0,%rax
je     11f9 <evalrel+0xd9>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <evalsh@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
cltq
mov    %rax,-0x8(%rbp)
jmp    1245 <evalrel+0x125>
lea    0xe08(%rip),%rdi
call   1040 <test@plt>
cmp    $0x0,%rax
je     123b <evalrel+0x11b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1030 <evalsh@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
cltq
mov    %rax,-0x8(%rbp)
jmp    1240 <evalrel+0x120>
jmp    1254 <evalrel+0x134>
jmp    1245 <evalrel+0x125>
jmp    124a <evalrel+0x12a>
jmp    124f <evalrel+0x12f>
jmp    1133 <evalrel+0x13>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evalrel>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
xor    %eax,%eax
call   1030 <evalsh@plt>
mov    %rax,%rbx
lea    0xec6(%rip),%r13
lea    0xec2(%rip),%r14
lea    0xebe(%rip),%r15
lea    0xeb9(%rip),%r12
jmp    1170 <evalrel+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <evalsh@plt>
cmp    %rax,%rbx
setle  %al
movzbl %al,%ebx
mov    %r13,%rdi
call   1040 <test@plt>
test   %rax,%rax
jne    1160 <evalrel+0x40>
mov    %r14,%rdi
call   1040 <test@plt>
test   %rax,%rax
je     119c <evalrel+0x7c>
xor    %eax,%eax
call   1030 <evalsh@plt>
cmp    %rax,%rbx
setge  %al
movzbl %al,%ebx
jmp    1170 <evalrel+0x50>
mov    %r15,%rdi
call   1040 <test@plt>
test   %rax,%rax
je     11bb <evalrel+0x9b>
xor    %eax,%eax
call   1030 <evalsh@plt>
cmp    %rax,%rbx
setl   %al
movzbl %al,%ebx
jmp    1170 <evalrel+0x50>
mov    %r12,%rdi
call   1040 <test@plt>
test   %rax,%rax
je     11da <evalrel+0xba>
xor    %eax,%eax
call   1030 <evalsh@plt>
cmp    %rax,%rbx
setg   %al
movzbl %al,%ebx
jmp    1170 <evalrel+0x50>
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"<=\00"
@.str.1 = [3 x i8] c">=\00"
@.str.2 = [2 x i8] c"<\00"
@.str.3 = [2 x i8] c">\00"
define i64 @evalrel() {
%1 = alloca i64
%2 = call i64 (...) @evalsh()
store i64 %2, i64* %1
br label %3
3: ; preds = %43, %0
%4 = call i64 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i64, i64* %1
%8 = call i64 (...) @evalsh()
%9 = icmp sle i64 %7, %8
%10 = zext i1 %9 to i32
%11 = sext i32 %10 to i64
store i64 %11, i64* %1
br label %43
12: ; preds = %3
%13 = call i64 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i64, i64* %1
%17 = call i64 (...) @evalsh()
%18 = icmp sge i64 %16, %17
%19 = zext i1 %18 to i32
%20 = sext i32 %19 to i64
store i64 %20, i64* %1
br label %42
21: ; preds = %12
%22 = call i64 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load i64, i64* %1
%26 = call i64 (...) @evalsh()
%27 = icmp slt i64 %25, %26
%28 = zext i1 %27 to i32
%29 = sext i32 %28 to i64
store i64 %29, i64* %1
br label %41
30: ; preds = %21
%31 = call i64 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = load i64, i64* %1
%35 = call i64 (...) @evalsh()
%36 = icmp sgt i64 %34, %35
%37 = zext i1 %36 to i32
%38 = sext i32 %37 to i64
store i64 %38, i64* %1
br label %40
39: ; preds = %30
br label %44
40: ; preds = %33
br label %41
41: ; preds = %40, %24
br label %42
42: ; preds = %41, %15
br label %43
43: ; preds = %42, %6
br label %3
44: ; preds = %39
%45 = load i64, i64* %1
ret i64 %45
}

LLVM IR (-O2):
@.str = [3 x i8] c"<=\00"
@.str.1 = [3 x i8] c">=\00"
@.str.2 = [2 x i8] c"<\00"
@.str.3 = [2 x i8] c">\00"
define i64 @evalrel() {
%1 = tail call i64 (...) @evalsh()
br label %2
2: ; preds = %27, %0
%3 = phi i64 [ %1, %0 ], [ %29, %27 ]
%4 = tail call i64 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i64 (...) @evalsh()
%8 = icmp sle i64 %3, %7
br label %27
9: ; preds = %2
%10 = tail call i64 @test(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = tail call i64 (...) @evalsh()
%14 = icmp sge i64 %3, %13
br label %27
15: ; preds = %9
%16 = tail call i64 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = tail call i64 (...) @evalsh()
%20 = icmp slt i64 %3, %19
br label %27
21: ; preds = %15
%22 = tail call i64 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %30, label %24
24: ; preds = %21
%25 = tail call i64 (...) @evalsh()
%26 = icmp sgt i64 %3, %25
br label %27
27: ; preds = %12, %24, %18, %6
%28 = phi i1 [ %8, %6 ], [ %14, %12 ], [ %20, %18 ], [ %26, %24 ]
%29 = zext i1 %28 to i64
br label %2
30: ; preds = %21
ret i64 %3
}