#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 print_cond(void) {
  static int x = 1;
  x = (x + 1) & 0x1f;
  switch (x) {
  case 0x02:
    printf("eq0");
    break;
  case 0x0d:
    printf("ne0");
    break;
  case 0x01:
    printf("gt0");
    break;
  case 0x0c:
    printf("lt0");
    break;
  case 0x03:
    printf("ge0");
    break;
  case 0x0e:
    printf("le0");
    break;
  default:
    printf("%d", x);
  }
}


x86 assembly (clang, -O0):
<print_cond>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2f0a(%rip),%eax
add    $0x1,%eax
and    $0x1f,%eax
mov    %eax,0x2efe(%rip)
mov    0x2ef8(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x8(%rbp)
sub    $0xd,%eax
ja     11c8 <print_cond+0xb8>
mov    -0x8(%rbp),%rax
lea    0xeb3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <print_cond+0xcc>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <print_cond+0xcc>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <print_cond+0xcc>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <print_cond+0xcc>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <print_cond+0xcc>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <print_cond+0xcc>
mov    0x2e5a(%rip),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_cond>:
mov    0x2f12(%rip),%esi
add    $0x1,%esi
and    $0x1f,%esi
mov    %esi,0x2f06(%rip)
lea    -0x1(%rsi),%eax
cmp    $0xd,%eax
ja     1164 <print_cond+0x54>
lea    0xecf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeff(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xeeb(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xee5(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@print_cond.x = internal global i32 1
@.str = [4 x i8] c"eq0\00"
@.str.1 = [4 x i8] c"ne0\00"
@.str.2 = [4 x i8] c"gt0\00"
@.str.3 = [4 x i8] c"lt0\00"
@.str.4 = [4 x i8] c"ge0\00"
@.str.5 = [4 x i8] c"le0\00"
@.str.6 = [3 x i8] c"%d\00"
define void @print_cond() {
%1 = load i32, i32* @print_cond.x
%2 = add nsw i32 %1, 1
%3 = and i32 %2, 31
store i32 %3, i32* @print_cond.x
%4 = load i32, i32* @print_cond.x
switch i32 %4, label %17 [
i32 2, label %5
i32 13, label %7
i32 1, label %9
i32 12, label %11
i32 3, label %13
i32 14, label %15
]
5: ; preds = %0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %20
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %20
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %20
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %20
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %20
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %20
17: ; preds = %0
%18 = load i32, i32* @print_cond.x
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %17, %15, %13, %11, %9, %7, %5
ret void
}

LLVM IR (-O2):
@print_cond.x = internal unnamed_addr global i32 1
@.str = [4 x i8] c"eq0\00"
@.str.1 = [4 x i8] c"ne0\00"
@.str.2 = [4 x i8] c"gt0\00"
@.str.3 = [4 x i8] c"lt0\00"
@.str.4 = [4 x i8] c"ge0\00"
@.str.5 = [4 x i8] c"le0\00"
@.str.6 = [3 x i8] c"%d\00"
define void @print_cond() {
%1 = load i32, i32* @print_cond.x
%2 = add nsw i32 %1, 1
%3 = and i32 %2, 31
store i32 %3, i32* @print_cond.x
switch i32 %3, label %16 [
i32 2, label %4
i32 13, label %6
i32 1, label %8
i32 12, label %10
i32 3, label %12
i32 14, label %14
]
4: ; preds = %0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %18
6: ; preds = %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %18
8: ; preds = %0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %18
10: ; preds = %0
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %18
12: ; preds = %0
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %18
14: ; preds = %0
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %18
16: ; preds = %0
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %3)
br label %18
18: ; preds = %16, %14, %12, %10, %8, %6, %4
ret void
}