#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*/ is_carry_flag_set();
int /*<<< orphan*/ is_parity_flag_set();
int /*<<< orphan*/ is_sign_flag_set();
int /*<<< orphan*/ is_zero_flag_set();
int /*<<< orphan*/ return_plain();
void return_condition(int condition) {
  switch (condition) {
  case 0b000:
    if (!is_zero_flag_set()) {
      return_plain();
    }
    break;
  case 0b001:
    if (is_zero_flag_set()) {
      return_plain();
    }
    break;
  case 0b010:
    if (!is_carry_flag_set()) {
      return_plain();
    }
    break;
  case 0b011:
    if (is_carry_flag_set()) {
      return_plain();
    }
    break;
  case 0b100:
    if (!is_parity_flag_set()) {
      return_plain();
    }
    break;
  case 0b101:
    if (is_parity_flag_set()) {
      return_plain();
    }
    break;
  case 0b110:
    if (!is_sign_flag_set()) {
      return_plain();
    }
    break;
  case 0b111:
    if (is_sign_flag_set()) {
      return_plain();
    }
    break;
  }
}


x86 assembly (clang, -O0):
<return_condition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x7,%rax
ja     1260 <return_condition+0x110>
mov    -0x10(%rbp),%rax
lea    0xe89(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1060 <is_zero_flag_set@plt>
cmp    $0x0,%eax
jne    1197 <return_condition+0x47>
mov    $0x0,%al
call   1040 <return_plain@plt>
jmp    1260 <return_condition+0x110>
mov    $0x0,%al
call   1060 <is_zero_flag_set@plt>
cmp    $0x0,%eax
je     11b3 <return_condition+0x63>
mov    $0x0,%al
call   1040 <return_plain@plt>
jmp    1260 <return_condition+0x110>
mov    $0x0,%al
call   1030 <is_carry_flag_set@plt>
cmp    $0x0,%eax
jne    11cf <return_condition+0x7f>
mov    $0x0,%al
call   1040 <return_plain@plt>
jmp    1260 <return_condition+0x110>
mov    $0x0,%al
call   1030 <is_carry_flag_set@plt>
cmp    $0x0,%eax
je     11eb <return_condition+0x9b>
mov    $0x0,%al
call   1040 <return_plain@plt>
jmp    1260 <return_condition+0x110>
mov    $0x0,%al
call   1050 <is_parity_flag_set@plt>
cmp    $0x0,%eax
jne    1207 <return_condition+0xb7>
mov    $0x0,%al
call   1040 <return_plain@plt>
jmp    1260 <return_condition+0x110>
mov    $0x0,%al
call   1050 <is_parity_flag_set@plt>
cmp    $0x0,%eax
je     1223 <return_condition+0xd3>
mov    $0x0,%al
call   1040 <return_plain@plt>
jmp    1260 <return_condition+0x110>
mov    $0x0,%al
call   1070 <is_sign_flag_set@plt>
cmp    $0x0,%eax
jne    123f <return_condition+0xef>
mov    $0x0,%al
call   1040 <return_plain@plt>
jmp    1260 <return_condition+0x110>
mov    $0x0,%al
call   1070 <is_sign_flag_set@plt>
cmp    $0x0,%eax
je     125b <return_condition+0x10b>
mov    $0x0,%al
call   1040 <return_plain@plt>
jmp    1260 <return_condition+0x110>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_condition>:
push   %rax
cmp    $0x7,%edi
ja     11c1 <return_condition+0x71>
mov    %edi,%eax
lea    0xea1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <is_zero_flag_set@plt>
test   %eax,%eax
jne    11c1 <return_condition+0x71>
jmp    11ce <return_condition+0x7e>
xor    %eax,%eax
call   1060 <is_zero_flag_set@plt>
test   %eax,%eax
jne    11ce <return_condition+0x7e>
jmp    11c1 <return_condition+0x71>
xor    %eax,%eax
call   1030 <is_carry_flag_set@plt>
test   %eax,%eax
jne    11c1 <return_condition+0x71>
jmp    11ce <return_condition+0x7e>
xor    %eax,%eax
call   1030 <is_carry_flag_set@plt>
test   %eax,%eax
jne    11ce <return_condition+0x7e>
jmp    11c1 <return_condition+0x71>
xor    %eax,%eax
call   1050 <is_parity_flag_set@plt>
test   %eax,%eax
jne    11c1 <return_condition+0x71>
jmp    11ce <return_condition+0x7e>
xor    %eax,%eax
call   1050 <is_parity_flag_set@plt>
test   %eax,%eax
jne    11ce <return_condition+0x7e>
jmp    11c1 <return_condition+0x71>
xor    %eax,%eax
call   1070 <is_sign_flag_set@plt>
test   %eax,%eax
je     11ce <return_condition+0x7e>
pop    %rax
ret
xor    %eax,%eax
call   1070 <is_sign_flag_set@plt>
test   %eax,%eax
je     11c1 <return_condition+0x71>
xor    %eax,%eax
pop    %rcx
jmp    1040 <return_plain@plt>

LLVM IR (-O0):
define void @return_condition(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %52 [
i32 0, label %4
i32 1, label %10
i32 2, label %16
i32 3, label %22
i32 4, label %28
i32 5, label %34
i32 6, label %40
i32 7, label %46
]
4: ; preds = %1
%5 = call i32 (...) @is_zero_flag_set()
%6 = icmp ne i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = call i32 (...) @return_plain()
br label %9
9: ; preds = %7, %4
br label %52
10: ; preds = %1
%11 = call i32 (...) @is_zero_flag_set()
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (...) @return_plain()
br label %15
15: ; preds = %13, %10
br label %52
16: ; preds = %1
%17 = call i32 (...) @is_carry_flag_set()
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = call i32 (...) @return_plain()
br label %21
21: ; preds = %19, %16
br label %52
22: ; preds = %1
%23 = call i32 (...) @is_carry_flag_set()
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (...) @return_plain()
br label %27
27: ; preds = %25, %22
br label %52
28: ; preds = %1
%29 = call i32 (...) @is_parity_flag_set()
%30 = icmp ne i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = call i32 (...) @return_plain()
br label %33
33: ; preds = %31, %28
br label %52
34: ; preds = %1
%35 = call i32 (...) @is_parity_flag_set()
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 (...) @return_plain()
br label %39
39: ; preds = %37, %34
br label %52
40: ; preds = %1
%41 = call i32 (...) @is_sign_flag_set()
%42 = icmp ne i32 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = call i32 (...) @return_plain()
br label %45
45: ; preds = %43, %40
br label %52
46: ; preds = %1
%47 = call i32 (...) @is_sign_flag_set()
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 (...) @return_plain()
br label %51
51: ; preds = %49, %46
br label %52
52: ; preds = %1, %51, %45, %39, %33, %27, %21, %15, %9
ret void
}

LLVM IR (-O2):
define void @return_condition(i32 %0) {
switch i32 %0, label %28 [
i32 0, label %2
i32 1, label %5
i32 2, label %8
i32 3, label %11
i32 4, label %14
i32 5, label %17
i32 6, label %20
i32 7, label %23
]
2: ; preds = %1
%3 = tail call i32 (...) @is_zero_flag_set()
%4 = icmp eq i32 %3, 0
br i1 %4, label %26, label %28
5: ; preds = %1
%6 = tail call i32 (...) @is_zero_flag_set()
%7 = icmp eq i32 %6, 0
br i1 %7, label %28, label %26
8: ; preds = %1
%9 = tail call i32 (...) @is_carry_flag_set()
%10 = icmp eq i32 %9, 0
br i1 %10, label %26, label %28
11: ; preds = %1
%12 = tail call i32 (...) @is_carry_flag_set()
%13 = icmp eq i32 %12, 0
br i1 %13, label %28, label %26
14: ; preds = %1
%15 = tail call i32 (...) @is_parity_flag_set()
%16 = icmp eq i32 %15, 0
br i1 %16, label %26, label %28
17: ; preds = %1
%18 = tail call i32 (...) @is_parity_flag_set()
%19 = icmp eq i32 %18, 0
br i1 %19, label %28, label %26
20: ; preds = %1
%21 = tail call i32 (...) @is_sign_flag_set()
%22 = icmp eq i32 %21, 0
br i1 %22, label %26, label %28
23: ; preds = %1
%24 = tail call i32 (...) @is_sign_flag_set()
%25 = icmp eq i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23, %20, %17, %14, %11, %8, %5, %2
%27 = tail call i32 (...) @return_plain()
br label %28
28: ; preds = %26, %23, %20, %17, %14, %11, %8, %5, %2, %1
ret void
}