#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*/ printf(char *);
void check_cc(int value, int cc) {
  if (cc != value) {
    printf("wrong cc: ");
    if (value == 0)
      printf("expected 0  ");
    if (value == 1)
      printf("expected 1  ");
    if (value == 2)
      printf("expected 2  ");
    if (value == 3)
      printf("expected 3  ");
    if (cc == 0)
      printf("got 0");
    if (cc == 1)
      printf("got 1");
    if (cc == 2)
      printf("got 2");
    if (cc == 3)
      printf("got 3");
  } else {
    printf("OK");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<check_cc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     11eb <check_cc+0xdb>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
jne    114c <check_cc+0x3c>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    1162 <check_cc+0x52>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0x4(%rbp)
jne    1178 <check_cc+0x68>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x3,-0x4(%rbp)
jne    118e <check_cc+0x7e>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11a4 <check_cc+0x94>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11ba <check_cc+0xaa>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jne    11d0 <check_cc+0xc0>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jne    11e6 <check_cc+0xd6>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
jmp    11f7 <check_cc+0xe7>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_cc>:
push   %rbp
push   %rbx
push   %rax
cmp    %edi,%esi
jne    1130 <check_cc+0x10>
lea    0xf29(%rip),%rdi
jmp    1171 <check_cc+0x51>
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
cmp    $0x3,%ebp
ja     115b <check_cc+0x3b>
movslq %ebp,%rax
lea    0xf0d(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1040 <printf@plt>
cmp    $0x3,%ebx
ja     1176 <check_cc+0x56>
movslq %ebx,%rax
lea    0xf02(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"wrong cc: \00"
@.str.1 = [13 x i8] c"expected 0 \00"
@.str.2 = [13 x i8] c"expected 1 \00"
@.str.3 = [13 x i8] c"expected 2 \00"
@.str.4 = [13 x i8] c"expected 3 \00"
@.str.5 = [6 x i8] c"got 0\00"
@.str.6 = [6 x i8] c"got 1\00"
@.str.7 = [6 x i8] c"got 2\00"
@.str.8 = [6 x i8] c"got 3\00"
@.str.9 = [3 x i8] c"OK\00"
@.str.10 = [2 x i8] c"\0A\00"
define void @check_cc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %50
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 3
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %29
29: ; preds = %27, %24
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = load i32, i32* %4
%41 = icmp eq i32 %40, 2
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %44
44: ; preds = %42, %39
%45 = load i32, i32* %4
%46 = icmp eq i32 %45, 3
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %49
49: ; preds = %47, %44
br label %52
50: ; preds = %2
%51 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %52
52: ; preds = %50, %49
%53 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"wrong cc: \00"
@.str.1 = [13 x i8] c"expected 0 \00"
@.str.2 = [13 x i8] c"expected 1 \00"
@.str.3 = [13 x i8] c"expected 2 \00"
@.str.4 = [13 x i8] c"expected 3 \00"
@.str.5 = [6 x i8] c"got 0\00"
@.str.6 = [6 x i8] c"got 1\00"
@.str.7 = [6 x i8] c"got 2\00"
@.str.8 = [6 x i8] c"got 3\00"
@.str.9 = [3 x i8] c"OK\00"
@reltable.check_cc = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.check_cc to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.check_cc to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.check_cc to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.4 to i64), i64 ptrtoint ([4 x i32]* @reltable.check_cc to i64)) to i32)]
@reltable.check_cc.12 = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.5 to i64), i64 ptrtoint ([4 x i32]* @reltable.check_cc.12 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.6 to i64), i64 ptrtoint ([4 x i32]* @reltable.check_cc.12 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.7 to i64), i64 ptrtoint ([4 x i32]* @reltable.check_cc.12 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.8 to i64), i64 ptrtoint ([4 x i32]* @reltable.check_cc.12 to i64)) to i32)]
define void @check_cc(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, %0
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = icmp ult i32 %0, 4
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = sext i32 %0 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.check_cc to i8*), i64 %9)
%11 = tail call i32 @printf(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %4, %7
%13 = icmp ult i32 %1, 4
br i1 %13, label %14, label %21
14: ; preds = %12
%15 = sext i32 %1 to i64
%16 = shl i64 %15, 2
%17 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.check_cc.12 to i8*), i64 %16)
br label %18
18: ; preds = %14, %2
%19 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), %2 ], [ %17, %14 ]
%20 = tail call i32 @printf(i8* dereferenceable(1) %19)
br label %21
21: ; preds = %12, %18
%22 = tail call i32 @putchar(i32 10)
ret void
}