#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 */
scalar_t__ strcmp(char *, char *);
long long strtoll(char *, int /*<<< orphan*/ *, int);
int cmp_integer(char *op, char *l, char *r) {
  long long ll = strtoll(l, NULL, 10);
  long long lr = strtoll(r, NULL, 10);
  if (strcmp(op, "==") == 0)
    return ll == lr;
  if (strcmp(op, "!=") == 0)
    return ll != lr;
  if (strcmp(op, ">=") == 0)
    return ll >= lr;
  if (strcmp(op, "<=") == 0)
    return ll <= lr;
  if (strcmp(op, ">") == 0)
    return ll > lr;
  if (strcmp(op, "<") == 0)
    return ll < lr;
  return 0;
}


x86 assembly (clang, -O0):
<cmp_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtoll@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtoll@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1192 <cmp_integer+0x72>
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1293 <cmp_integer+0x173>
mov    -0x10(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11c4 <cmp_integer+0xa4>
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1293 <cmp_integer+0x173>
mov    -0x10(%rbp),%rdi
lea    0xe37(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11f6 <cmp_integer+0xd6>
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1293 <cmp_integer+0x173>
mov    -0x10(%rbp),%rdi
lea    0xe08(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1228 <cmp_integer+0x108>
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
setle  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1293 <cmp_integer+0x173>
mov    -0x10(%rbp),%rdi
lea    0xdd9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    125a <cmp_integer+0x13a>
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1293 <cmp_integer+0x173>
mov    -0x10(%rbp),%rdi
lea    0xda9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    128c <cmp_integer+0x16c>
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1293 <cmp_integer+0x173>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_integer>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r12
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoll@plt>
mov    %rax,%r14
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoll@plt>
mov    %rax,%r15
lea    0xea7(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11d5 <cmp_integer+0xb5>
lea    0xe96(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11dd <cmp_integer+0xbd>
lea    0xe85(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11e5 <cmp_integer+0xc5>
lea    0xe74(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11ed <cmp_integer+0xcd>
lea    0xe63(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11f5 <cmp_integer+0xd5>
lea    0xe51(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
sete   %cl
cmp    %r15,%r14
setl   %al
and    %cl,%al
jmp    11fb <cmp_integer+0xdb>
cmp    %r15,%r14
sete   %al
jmp    11fb <cmp_integer+0xdb>
cmp    %r15,%r14
setne  %al
jmp    11fb <cmp_integer+0xdb>
cmp    %r15,%r14
setge  %al
jmp    11fb <cmp_integer+0xdb>
cmp    %r15,%r14
setle  %al
jmp    11fb <cmp_integer+0xdb>
cmp    %r15,%r14
setg   %al
movzbl %al,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"==\00"
@.str.1 = [3 x i8] c"!=\00"
@.str.2 = [3 x i8] c">=\00"
@.str.3 = [3 x i8] c"<=\00"
@.str.4 = [2 x i8] c">\00"
@.str.5 = [2 x i8] c"<\00"
define i32 @cmp_integer(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%10 = load i8*, i8** %6
%11 = call i64 @strtoll(i8* %10, i32* null, i32 10)
store i64 %11, i64* %8
%12 = load i8*, i8** %7
%13 = call i64 @strtoll(i8* %12, i32* null, i32 10)
store i64 %13, i64* %9
%14 = load i8*, i8** %5
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %3
%18 = load i64, i64* %8
%19 = load i64, i64* %9
%20 = icmp eq i64 %18, %19
%21 = zext i1 %20 to i32
store i32 %21, i32* %4
br label %68
22: ; preds = %3
%23 = load i8*, i8** %5
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i64, i64* %8
%28 = load i64, i64* %9
%29 = icmp ne i64 %27, %28
%30 = zext i1 %29 to i32
store i32 %30, i32* %4
br label %68
31: ; preds = %22
%32 = load i8*, i8** %5
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = load i64, i64* %8
%37 = load i64, i64* %9
%38 = icmp sge i64 %36, %37
%39 = zext i1 %38 to i32
store i32 %39, i32* %4
br label %68
40: ; preds = %31
%41 = load i8*, i8** %5
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %40
%45 = load i64, i64* %8
%46 = load i64, i64* %9
%47 = icmp sle i64 %45, %46
%48 = zext i1 %47 to i32
store i32 %48, i32* %4
br label %68
49: ; preds = %40
%50 = load i8*, i8** %5
%51 = call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %58
53: ; preds = %49
%54 = load i64, i64* %8
%55 = load i64, i64* %9
%56 = icmp sgt i64 %54, %55
%57 = zext i1 %56 to i32
store i32 %57, i32* %4
br label %68
58: ; preds = %49
%59 = load i8*, i8** %5
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %67
62: ; preds = %58
%63 = load i64, i64* %8
%64 = load i64, i64* %9
%65 = icmp slt i64 %63, %64
%66 = zext i1 %65 to i32
store i32 %66, i32* %4
br label %68
67: ; preds = %58
store i32 0, i32* %4
br label %68
68: ; preds = %67, %62, %53, %44, %35, %26, %17
%69 = load i32, i32* %4
ret i32 %69
}

LLVM IR (-O2):
@.str = [3 x i8] c"==\00"
@.str.1 = [3 x i8] c"!=\00"
@.str.2 = [3 x i8] c">=\00"
@.str.3 = [3 x i8] c"<=\00"
@.str.4 = [2 x i8] c">\00"
@.str.5 = [2 x i8] c"<\00"
define i32 @cmp_integer(i8* %0, i8* nocapture %1, i8* nocapture %2) {
%4 = tail call i64 @strtoll(i8* nocapture %1, i32* null, i32 10)
%5 = tail call i64 @strtoll(i8* nocapture %2, i32* null, i32 10)
%6 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = icmp eq i64 %4, %5
br label %35
10: ; preds = %3
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = icmp ne i64 %4, %5
br label %35
15: ; preds = %10
%16 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = icmp sge i64 %4, %5
br label %35
20: ; preds = %15
%21 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = icmp sle i64 %4, %5
br label %35
25: ; preds = %20
%26 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = icmp sgt i64 %4, %5
br label %35
30: ; preds = %25
%31 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
%33 = icmp slt i64 %4, %5
%34 = select i1 %32, i1 %33, i1 false
br label %35
35: ; preds = %30, %28, %23, %18, %13, %8
%36 = phi i1 [ %9, %8 ], [ %14, %13 ], [ %19, %18 ], [ %24, %23 ], [ %29, %28 ], [ %34, %30 ]
%37 = zext i1 %36 to i32
ret i32 %37
}