int test_intcmp() {
  int val_1;
  int val_2;
  val_1 = 1;
  val_2 = 1;
  int result = intcmp_asc(val_1, val_2);
  do {
    if (!(result == 0)) {
      printf("%sERROR!%s [%s:%d] %s\n", "\x1B[1;31m", "\x1B[1;0m", __func__, 43,
             "Result should be 0!");
      return -1;
    }
  } while (0);
  val_2 = 10;
  result = intcmp_asc(val_1, val_2);
  do {
    if (!(result == -1)) {
      printf("%sERROR!%s [%s:%d] %s\n", "\x1B[1;31m", "\x1B[1;0m", __func__, 48,
             "Result should be -1!");
      return -1;
    }
  } while (0);
  val_2 = -1;
  result = intcmp_asc(val_1, val_2);
  do {
    if (!(result == 1)) {
      printf("%sERROR!%s [%s:%d] %s\n", "\x1B[1;31m", "\x1B[1;0m", __func__, 53,
             "Result should be 1!");
      return -1;
    }
  } while (0);
  val_1 = 1;
  val_2 = 1;
  result = intcmp_desc(val_1, val_2);
  do {
    if (!(result == 0)) {
      printf("%sERROR!%s [%s:%d] %s\n", "\x1B[1;31m", "\x1B[1;0m", __func__, 62,
             "Result should be 0!");
      return -1;
    }
  } while (0);
  val_2 = 10;
  result = intcmp_desc(val_1, val_2);
  do {
    if (!(result == 1)) {
      printf("%sERROR!%s [%s:%d] %s\n", "\x1B[1;31m", "\x1B[1;0m", __func__, 67,
             "Result should be 1!");
      return -1;
    }
  } while (0);
  val_2 = -1;
  result = intcmp_desc(val_1, val_2);
  do {
    if (!(result == -1)) {
      printf("%sERROR!%s [%s:%d] %s\n", "\x1B[1;31m", "\x1B[1;0m", __func__, 72,
             "Result should be -1!");
      return -1;
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_intcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1050 <intcmp_asc@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     119c <test_intcmp+0x6c>
lea    0xe99(%rip),%rdi
lea    0xea9(%rip),%rsi
lea    0xeaa(%rip),%rdx
lea    0xeaa(%rip),%rcx
mov    $0x2b,%r8d
lea    0xea9(%rip),%r9
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1399 <test_intcmp+0x269>
jmp    11a1 <test_intcmp+0x71>
movl   $0xa,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1050 <intcmp_asc@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
je     11fe <test_intcmp+0xce>
lea    0xe37(%rip),%rdi
lea    0xe47(%rip),%rsi
lea    0xe48(%rip),%rdx
lea    0xe48(%rip),%rcx
mov    $0x30,%r8d
lea    0xe5b(%rip),%r9
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1399 <test_intcmp+0x269>
jmp    1203 <test_intcmp+0xd3>
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1050 <intcmp_asc@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
je     1260 <test_intcmp+0x130>
lea    0xdd5(%rip),%rdi
lea    0xde5(%rip),%rsi
lea    0xde6(%rip),%rdx
lea    0xde6(%rip),%rcx
mov    $0x35,%r8d
lea    0xe0e(%rip),%r9
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1399 <test_intcmp+0x269>
jmp    1265 <test_intcmp+0x135>
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1040 <intcmp_desc@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     12c9 <test_intcmp+0x199>
lea    0xd6c(%rip),%rdi
lea    0xd7c(%rip),%rsi
lea    0xd7d(%rip),%rdx
lea    0xd7d(%rip),%rcx
mov    $0x3e,%r8d
lea    0xd7c(%rip),%r9
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1399 <test_intcmp+0x269>
jmp    12ce <test_intcmp+0x19e>
movl   $0xa,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1040 <intcmp_desc@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
je     132b <test_intcmp+0x1fb>
lea    0xd0a(%rip),%rdi
lea    0xd1a(%rip),%rsi
lea    0xd1b(%rip),%rdx
lea    0xd1b(%rip),%rcx
mov    $0x43,%r8d
lea    0xd43(%rip),%r9
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1399 <test_intcmp+0x269>
jmp    1330 <test_intcmp+0x200>
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1040 <intcmp_desc@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
je     138d <test_intcmp+0x25d>
lea    0xca8(%rip),%rdi
lea    0xcb8(%rip),%rsi
lea    0xcb9(%rip),%rdx
lea    0xcb9(%rip),%rcx
mov    $0x48,%r8d
lea    0xccc(%rip),%r9
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1399 <test_intcmp+0x269>
jmp    1392 <test_intcmp+0x262>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_intcmp>:
push   %rbx
mov    $0x1,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <intcmp_asc@plt>
test   %eax,%eax
je     1174 <test_intcmp+0x44>
lea    0xeb3(%rip),%rdi
lea    0xec3(%rip),%rsi
lea    0xec4(%rip),%rdx
lea    0xec4(%rip),%rcx
lea    0xec9(%rip),%r9
mov    $0x2b,%r8d
jmp    1234 <test_intcmp+0x104>
mov    $0x1,%edi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <intcmp_asc@plt>
cmp    $0xffffffff,%eax
je     11b5 <test_intcmp+0x85>
lea    0xe6f(%rip),%rdi
lea    0xe7f(%rip),%rsi
lea    0xe80(%rip),%rdx
lea    0xe80(%rip),%rcx
lea    0xe99(%rip),%r9
mov    $0x30,%r8d
jmp    1234 <test_intcmp+0x104>
mov    $0x1,%edi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1050 <intcmp_asc@plt>
cmp    $0x1,%eax
jne    120b <test_intcmp+0xdb>
mov    $0x1,%edi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <intcmp_desc@plt>
test   %eax,%eax
je     1244 <test_intcmp+0x114>
lea    0xe19(%rip),%rdi
lea    0xe29(%rip),%rsi
lea    0xe2a(%rip),%rdx
lea    0xe2a(%rip),%rcx
lea    0xe2f(%rip),%r9
mov    $0x3e,%r8d
jmp    1234 <test_intcmp+0x104>
lea    0xdee(%rip),%rdi
lea    0xdfe(%rip),%rsi
lea    0xdff(%rip),%rdx
lea    0xdff(%rip),%rcx
lea    0xe2d(%rip),%r9
mov    $0x35,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret
xor    %ebx,%ebx
mov    $0x1,%edi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <intcmp_desc@plt>
cmp    $0x1,%eax
jne    129d <test_intcmp+0x16d>
mov    $0x1,%edi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1040 <intcmp_desc@plt>
cmp    $0xffffffff,%eax
je     1240 <test_intcmp+0x110>
lea    0xd87(%rip),%rdi
lea    0xd97(%rip),%rsi
lea    0xd98(%rip),%rdx
lea    0xd98(%rip),%rcx
lea    0xdb1(%rip),%r9
mov    $0x48,%r8d
jmp    1234 <test_intcmp+0x104>
lea    0xd5c(%rip),%rdi
lea    0xd6c(%rip),%rsi
lea    0xd6d(%rip),%rdx
lea    0xd6d(%rip),%rcx
lea    0xd9b(%rip),%r9
mov    $0x43,%r8d
jmp    1234 <test_intcmp+0x104>

LLVM IR (-O0):
@.str = [23 x i8] c"%sERROR!%s [%s:%d] %s\0A\00"
@.str.1 = [8 x i8] c"\1B[1;31m\00"
@.str.2 = [7 x i8] c"\1B[1;0m\00"
@__func__.test_intcmp = [12 x i8] c"test_intcmp\00"
@.str.3 = [20 x i8] c"Result should be 0!\00"
@.str.4 = [21 x i8] c"Result should be -1!\00"
@.str.5 = [20 x i8] c"Result should be 1!\00"
define i32 @test_intcmp() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 1, i32* %2
store i32 1, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_asc to i32 (i32, i32, ...)*)(i32 %5, i32 %6)
store i32 %7, i32* %4
br label %8
8: ; preds = %0
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 43, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %65
13: ; preds = %8
br label %14
14: ; preds = %13
store i32 10, i32* %3
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_asc to i32 (i32, i32, ...)*)(i32 %15, i32 %16)
store i32 %17, i32* %4
br label %18
18: ; preds = %14
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, -1
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 48, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %1
br label %65
23: ; preds = %18
br label %24
24: ; preds = %23
store i32 -1, i32* %3
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_asc to i32 (i32, i32, ...)*)(i32 %25, i32 %26)
store i32 %27, i32* %4
br label %28
28: ; preds = %24
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 1
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %1
br label %65
33: ; preds = %28
br label %34
34: ; preds = %33
store i32 1, i32* %2
store i32 1, i32* %3
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_desc to i32 (i32, i32, ...)*)(i32 %35, i32 %36)
store i32 %37, i32* %4
br label %38
38: ; preds = %34
%39 = load i32, i32* %4
%40 = icmp eq i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 62, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %65
43: ; preds = %38
br label %44
44: ; preds = %43
store i32 10, i32* %3
%45 = load i32, i32* %2
%46 = load i32, i32* %3
%47 = call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_desc to i32 (i32, i32, ...)*)(i32 %45, i32 %46)
store i32 %47, i32* %4
br label %48
48: ; preds = %44
%49 = load i32, i32* %4
%50 = icmp eq i32 %49, 1
br i1 %50, label %53, label %51
51: ; preds = %48
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 67, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %1
br label %65
53: ; preds = %48
br label %54
54: ; preds = %53
store i32 -1, i32* %3
%55 = load i32, i32* %2
%56 = load i32, i32* %3
%57 = call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_desc to i32 (i32, i32, ...)*)(i32 %55, i32 %56)
store i32 %57, i32* %4
br label %58
58: ; preds = %54
%59 = load i32, i32* %4
%60 = icmp eq i32 %59, -1
br i1 %60, label %63, label %61
61: ; preds = %58
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 72, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %1
br label %65
63: ; preds = %58
br label %64
64: ; preds = %63
store i32 0, i32* %1
br label %65
65: ; preds = %64, %61, %51, %41, %31, %21, %11
%66 = load i32, i32* %1
ret i32 %66
}

LLVM IR (-O2):
@.str = [23 x i8] c"%sERROR!%s [%s:%d] %s\0A\00"
@.str.1 = [8 x i8] c"\1B[1;31m\00"
@.str.2 = [7 x i8] c"\1B[1;0m\00"
@__func__.test_intcmp = [12 x i8] c"test_intcmp\00"
@.str.3 = [20 x i8] c"Result should be 0!\00"
@.str.4 = [21 x i8] c"Result should be -1!\00"
@.str.5 = [20 x i8] c"Result should be 1!\00"
define i32 @test_intcmp() {
%1 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_asc to i32 (i32, i32, ...)*)(i32 1, i32 1)
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 43, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %30
5: ; preds = %0
%6 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_asc to i32 (i32, i32, ...)*)(i32 1, i32 10)
%7 = icmp eq i32 %6, -1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 48, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %30
10: ; preds = %5
%11 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_asc to i32 (i32, i32, ...)*)(i32 1, i32 -1)
%12 = icmp eq i32 %11, 1
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %30
15: ; preds = %10
%16 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_desc to i32 (i32, i32, ...)*)(i32 1, i32 1)
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 62, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %30
20: ; preds = %15
%21 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_desc to i32 (i32, i32, ...)*)(i32 1, i32 10)
%22 = icmp eq i32 %21, 1
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 67, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %30
25: ; preds = %20
%26 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @intcmp_desc to i32 (i32, i32, ...)*)(i32 1, i32 -1)
%27 = icmp eq i32 %26, -1
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.test_intcmp, i64 0, i64 0), i32 72, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %25, %28, %23, %18, %13, %8, %3
%31 = phi i32 [ -1, %28 ], [ -1, %23 ], [ -1, %18 ], [ -1, %13 ], [ -1, %8 ], [ -1, %3 ], [ 0, %25 ]
ret i32 %31
}