#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*/ lprintf(char *, char *);
void print_etype(int type) {
  char *sep = "";
  if ((type & (1 << 0)) > 0) {
    lprintf("%skey", sep);
    sep = ",";
  }
  if ((type & (1 << 1)) > 0) {
    lprintf("%srep", sep);
    sep = ",";
  }
  if ((type & (1 << 2)) > 0) {
    lprintf("%srel", sep);
    sep = ",";
  }
}


x86 assembly (clang, -O0):
<print_etype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xee5(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jle    1150 <print_etype+0x40>
mov    -0x10(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1030 <lprintf@plt>
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jle    117a <print_etype+0x6a>
mov    -0x10(%rbp),%rsi
lea    0xe9e(%rip),%rdi
call   1030 <lprintf@plt>
lea    0xe90(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jle    11a4 <print_etype+0x94>
mov    -0x10(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1030 <lprintf@plt>
lea    0xe66(%rip),%rax
mov    %rax,-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_etype>:
push   %rbx
mov    %edi,%ebx
test   $0x1,%bl
jne    1126 <print_etype+0x16>
lea    0xee8(%rip),%rsi
test   $0x2,%bl
jne    1145 <print_etype+0x35>
jmp    1158 <print_etype+0x48>
lea    0xed3(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1030 <lprintf@plt>
lea    0xec6(%rip),%rsi
test   $0x2,%bl
je     1158 <print_etype+0x48>
lea    0xebc(%rip),%rdi
call   1030 <lprintf@plt>
lea    0xeae(%rip),%rsi
test   $0x4,%bl
jne    115f <print_etype+0x4f>
pop    %rbx
ret
lea    0xea8(%rip),%rdi
pop    %rbx
jmp    1030 <lprintf@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [6 x i8] c"%skey\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [6 x i8] c"%srep\00"
@.str.4 = [6 x i8] c"%srel\00"
define void @print_etype(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i32, i32* %2
%5 = and i32 %4, 1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @lprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %8)
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %10
10: ; preds = %7, %1
%11 = load i32, i32* %2
%12 = and i32 %11, 2
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = call i32 @lprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %15)
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %2
%19 = and i32 %18, 4
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i8*, i8** %3
%23 = call i32 @lprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %22)
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %24
24: ; preds = %21, %17
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [6 x i8] c"%skey\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [6 x i8] c"%srep\00"
@.str.4 = [6 x i8] c"%srel\00"
define void @print_etype(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @lprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %1 ]
%8 = and i32 %0, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 @lprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %7)
br label %12
12: ; preds = %10, %6
%13 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %10 ], [ %7, %6 ]
%14 = and i32 %0, 4
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = tail call i32 @lprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %13)
br label %18
18: ; preds = %16, %12
ret void
}