#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 /*<<< orphan*/ abs(int);
int ComparaNum(int a, int b, char type) {
  int result = 0;
  switch (type) {
  case 'A':
    if (a == b)
      result = 1;
    break;
  case 'B':
    if (abs(a) == abs(b))
      result = 1;
    break;
  case 'C':
    if ((a > 0 && b < 0) || (a < 0 && b > 0)) {
      if (abs(a) == abs(b))
        result = 1;
    }
    break;
  }
  return result;
}


x86 assembly (clang, -O0):
<ComparaNum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x41,%eax
je     1161 <ComparaNum+0x51>
jmp    113f <ComparaNum+0x2f>
mov    -0x14(%rbp),%eax
sub    $0x42,%eax
je     1179 <ComparaNum+0x69>
jmp    1150 <ComparaNum+0x40>
mov    -0x14(%rbp),%eax
sub    $0x43,%eax
je     11a5 <ComparaNum+0x95>
jmp    11fe <ComparaNum+0xee>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1174 <ComparaNum+0x64>
movl   $0x1,-0x10(%rbp)
jmp    11fe <ComparaNum+0xee>
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jne    11a0 <ComparaNum+0x90>
movl   $0x1,-0x10(%rbp)
jmp    11fe <ComparaNum+0xee>
cmpl   $0x0,-0x4(%rbp)
jle    11b9 <ComparaNum+0xa9>
cmpl   $0x0,-0x8(%rbp)
jl     11cd <ComparaNum+0xbd>
cmpl   $0x0,-0x4(%rbp)
jge    11f9 <ComparaNum+0xe9>
cmpl   $0x0,-0x8(%rbp)
jle    11f9 <ComparaNum+0xe9>
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jne    11f4 <ComparaNum+0xe4>
movl   $0x1,-0x10(%rbp)
jmp    11f9 <ComparaNum+0xe9>
jmp    11fe <ComparaNum+0xee>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComparaNum>:
cmp    $0x43,%edx
je     1113 <ComparaNum+0x13>
cmp    $0x42,%edx
je     1125 <ComparaNum+0x25>
cmp    $0x41,%edx
jne    113c <ComparaNum+0x3c>
cmp    %esi,%edi
jmp    1135 <ComparaNum+0x35>
test   %edi,%edi
jle    111b <ComparaNum+0x1b>
test   %esi,%esi
js     1125 <ComparaNum+0x25>
xor    %eax,%eax
test   %edi,%edi
jns    1138 <ComparaNum+0x38>
test   %esi,%esi
jle    1138 <ComparaNum+0x38>
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
mov    %esi,%ecx
neg    %ecx
cmovs  %esi,%ecx
cmp    %ecx,%eax
sete   %al
movzbl %al,%eax
ret
xor    %eax,%eax
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @ComparaNum(i32 %0, i32 %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8 %2, i8* %6
store i32 0, i32* %7
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
switch i32 %9, label %45 [
i32 65, label %10
i32 66, label %16
i32 67, label %24
]
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %7
br label %15
15: ; preds = %14, %10
br label %45
16: ; preds = %3
%17 = load i32, i32* %4
%18 = call i32 @abs(i32 %17)
%19 = load i32, i32* %5
%20 = call i32 @abs(i32 %19)
%21 = icmp eq i32 %18, %20
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 1, i32* %7
br label %23
23: ; preds = %22, %16
br label %45
24: ; preds = %3
%25 = load i32, i32* %4
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %5
%29 = icmp slt i32 %28, 0
br i1 %29, label %36, label %30
30: ; preds = %27, %24
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %44
33: ; preds = %30
%34 = load i32, i32* %5
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %44
36: ; preds = %33, %27
%37 = load i32, i32* %4
%38 = call i32 @abs(i32 %37)
%39 = load i32, i32* %5
%40 = call i32 @abs(i32 %39)
%41 = icmp eq i32 %38, %40
br i1 %41, label %42, label %43
42: ; preds = %36
store i32 1, i32* %7
br label %43
43: ; preds = %42, %36
br label %44
44: ; preds = %43, %33, %30
br label %45
45: ; preds = %3, %44, %23, %15
%46 = load i32, i32* %7
ret i32 %46
}

LLVM IR (-O2):
define i32 @ComparaNum(i32 %0, i32 %1, i8 signext %2) {
%4 = sext i8 %2 to i32
switch i32 %4, label %23 [
i32 65, label %5
i32 66, label %7
i32 67, label %11
]
5: ; preds = %3
%6 = icmp eq i32 %0, %1
br label %23
7: ; preds = %3
%8 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%9 = tail call i32 @llvm.abs.i32(i32 %1, i1 true)
%10 = icmp eq i32 %8, %9
br label %23
11: ; preds = %3
%12 = icmp sgt i32 %0, 0
%13 = icmp slt i32 %1, 0
%14 = and i1 %12, %13
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = icmp slt i32 %0, 0
%17 = icmp sgt i32 %1, 0
%18 = and i1 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %15, %11
%20 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%21 = tail call i32 @llvm.abs.i32(i32 %1, i1 true)
%22 = icmp eq i32 %20, %21
br label %23
23: ; preds = %19, %7, %5, %15, %3
%24 = phi i1 [ false, %3 ], [ false, %15 ], [ %6, %5 ], [ %10, %7 ], [ %22, %19 ]
%25 = zext i1 %24 to i32
ret i32 %25
}