#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*/ sprintf(char *, char *);
char *format_enc_ciphers(int ciphers) {
  static char str[128] = {0};
  char *pos = str;
  if (ciphers & (1 << 1))
    pos += sprintf(pos, "WEP-40, ");
  if (ciphers & (1 << 5))
    pos += sprintf(pos, "WEP-104, ");
  if (ciphers & (1 << 2))
    pos += sprintf(pos, "TKIP, ");
  if (ciphers & (1 << 4))
    pos += sprintf(pos, "CCMP, ");
  if (ciphers & (1 << 3))
    pos += sprintf(pos, "WRAP, ");
  if (ciphers & (1 << 6))
    pos += sprintf(pos, "AES-OCB, ");
  if (ciphers & (1 << 7))
    pos += sprintf(pos, "CKIP, ");
  if (!ciphers || (ciphers & (1 << 0)))
    pos += sprintf(pos, "NONE, ");
  *(pos - 2) = 0;
  return str;
}


x86 assembly (clang, -O0):
<format_enc_ciphers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0x2f1e(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1155 <format_enc_ciphers+0x45>
mov    -0x10(%rbp),%rdi
lea    0xec0(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1184 <format_enc_ciphers+0x74>
mov    -0x10(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11b3 <format_enc_ciphers+0xa3>
mov    -0x10(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11e2 <format_enc_ciphers+0xd2>
mov    -0x10(%rbp),%rdi
lea    0xe4d(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1211 <format_enc_ciphers+0x101>
mov    -0x10(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1240 <format_enc_ciphers+0x130>
mov    -0x10(%rbp),%rdi
lea    0xdfd(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1271 <format_enc_ciphers+0x161>
mov    -0x10(%rbp),%rdi
lea    0xdd6(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     128a <format_enc_ciphers+0x17a>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     12aa <format_enc_ciphers+0x19a>
mov    -0x10(%rbp),%rdi
lea    0xda4(%rip),%rsi
call   1030 <sprintf@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,-0x2(%rax)
lea    0x2d87(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_enc_ciphers>:
test   $0x2,%dil
jne    1115 <format_enc_ciphers+0x15>
lea    0x2f23(%rip),%rax
test   $0x20,%dil
jne    113a <format_enc_ciphers+0x3a>
jmp    1151 <format_enc_ciphers+0x51>
movabs $0x202c30342d504557,%rax
30 2c 20
mov    %rax,0x2f0a(%rip)
movb   $0x0,0x2f0b(%rip)
lea    0x2f04(%rip),%rax
test   $0x20,%dil
je     1151 <format_enc_ciphers+0x51>
movabs $0x2c3430312d504557,%rcx
30 34 2c
mov    %rcx,(%rax)
movw   $0x20,0x8(%rax)
add    $0x9,%rax
test   $0x4,%dil
jne    1175 <format_enc_ciphers+0x75>
test   $0x10,%dil
jne    118c <format_enc_ciphers+0x8c>
test   $0x8,%dil
jne    11a3 <format_enc_ciphers+0xa3>
test   $0x40,%dil
jne    11ba <format_enc_ciphers+0xba>
test   $0x80,%dil
jne    11d7 <format_enc_ciphers+0xd7>
test   %edi,%edi
jne    11ec <format_enc_ciphers+0xec>
jmp    11f1 <format_enc_ciphers+0xf1>
movl   $0x202c50,0x3(%rax)
movl   $0x50494b54,(%rax)
add    $0x6,%rax
test   $0x10,%dil
je     115d <format_enc_ciphers+0x5d>
movl   $0x202c50,0x3(%rax)
movl   $0x504d4343,(%rax)
add    $0x6,%rax
test   $0x8,%dil
je     1163 <format_enc_ciphers+0x63>
movl   $0x202c50,0x3(%rax)
movl   $0x50415257,(%rax)
add    $0x6,%rax
test   $0x40,%dil
je     1169 <format_enc_ciphers+0x69>
movabs $0x2c42434f2d534541,%rcx
43 42 2c
mov    %rcx,(%rax)
movw   $0x20,0x8(%rax)
add    $0x9,%rax
test   $0x80,%dil
je     116f <format_enc_ciphers+0x6f>
movl   $0x202c50,0x3(%rax)
movl   $0x50494b43,(%rax)
add    $0x6,%rax
test   %edi,%edi
je     11f1 <format_enc_ciphers+0xf1>
and    $0x1,%edi
je     1202 <format_enc_ciphers+0x102>
movl   $0x202c45,0x3(%rax)
movl   $0x454e4f4e,(%rax)
add    $0x6,%rax
movb   $0x0,-0x2(%rax)
lea    0x2e23(%rip),%rax
ret

LLVM IR (-O0):
@format_enc_ciphers.str = internal global [128 x i8] zeroinitializer
@.str = [9 x i8] c"WEP-40, \00"
@.str.1 = [10 x i8] c"WEP-104, \00"
@.str.2 = [7 x i8] c"TKIP, \00"
@.str.3 = [7 x i8] c"CCMP, \00"
@.str.4 = [7 x i8] c"WRAP, \00"
@.str.5 = [10 x i8] c"AES-OCB, \00"
@.str.6 = [7 x i8] c"CKIP, \00"
@.str.7 = [7 x i8] c"NONE, \00"
define i8* @format_enc_ciphers(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @format_enc_ciphers.str, i64 0, i64 0), i8** %3
%4 = load i32, i32* %2
%5 = and i32 %4, 2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = load i8*, i8** %3
%11 = sext i32 %9 to i64
%12 = getelementptr inbounds i8, i8* %10, i64 %11
store i8* %12, i8** %3
br label %13
13: ; preds = %7, %1
%14 = load i32, i32* %2
%15 = and i32 %14, 32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %13
%18 = load i8*, i8** %3
%19 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%20 = load i8*, i8** %3
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds i8, i8* %20, i64 %21
store i8* %22, i8** %3
br label %23
23: ; preds = %17, %13
%24 = load i32, i32* %2
%25 = and i32 %24, 4
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = load i8*, i8** %3
%29 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%30 = load i8*, i8** %3
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds i8, i8* %30, i64 %31
store i8* %32, i8** %3
br label %33
33: ; preds = %27, %23
%34 = load i32, i32* %2
%35 = and i32 %34, 16
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %33
%38 = load i8*, i8** %3
%39 = call i32 @sprintf(i8* %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%40 = load i8*, i8** %3
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds i8, i8* %40, i64 %41
store i8* %42, i8** %3
br label %43
43: ; preds = %37, %33
%44 = load i32, i32* %2
%45 = and i32 %44, 8
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %53
47: ; preds = %43
%48 = load i8*, i8** %3
%49 = call i32 @sprintf(i8* %48, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%50 = load i8*, i8** %3
%51 = sext i32 %49 to i64
%52 = getelementptr inbounds i8, i8* %50, i64 %51
store i8* %52, i8** %3
br label %53
53: ; preds = %47, %43
%54 = load i32, i32* %2
%55 = and i32 %54, 64
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %53
%58 = load i8*, i8** %3
%59 = call i32 @sprintf(i8* %58, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%60 = load i8*, i8** %3
%61 = sext i32 %59 to i64
%62 = getelementptr inbounds i8, i8* %60, i64 %61
store i8* %62, i8** %3
br label %63
63: ; preds = %57, %53
%64 = load i32, i32* %2
%65 = and i32 %64, 128
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %73
67: ; preds = %63
%68 = load i8*, i8** %3
%69 = call i32 @sprintf(i8* %68, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%70 = load i8*, i8** %3
%71 = sext i32 %69 to i64
%72 = getelementptr inbounds i8, i8* %70, i64 %71
store i8* %72, i8** %3
br label %73
73: ; preds = %67, %63
%74 = load i32, i32* %2
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %73
%77 = load i32, i32* %2
%78 = and i32 %77, 1
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %86
80: ; preds = %76, %73
%81 = load i8*, i8** %3
%82 = call i32 @sprintf(i8* %81, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%83 = load i8*, i8** %3
%84 = sext i32 %82 to i64
%85 = getelementptr inbounds i8, i8* %83, i64 %84
store i8* %85, i8** %3
br label %86
86: ; preds = %80, %76
%87 = load i8*, i8** %3
%88 = getelementptr inbounds i8, i8* %87, i64 -2
store i8 0, i8* %88
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @format_enc_ciphers.str, i64 0, i64 0)
}

LLVM IR (-O2):
@format_enc_ciphers.str = internal global [128 x i8] zeroinitializer
@.str = [9 x i8] c"WEP-40, \00"
@.str.1 = [10 x i8] c"WEP-104, \00"
@.str.2 = [7 x i8] c"TKIP, \00"
@.str.3 = [7 x i8] c"CCMP, \00"
@.str.4 = [7 x i8] c"WRAP, \00"
@.str.5 = [10 x i8] c"AES-OCB, \00"
@.str.6 = [7 x i8] c"CKIP, \00"
@.str.7 = [7 x i8] c"NONE, \00"
define i8* @format_enc_ciphers(i32 %0) {
%2 = and i32 %0, 2
%3 = icmp eq i32 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(9) getelementptr inbounds ([128 x i8], [128 x i8]* @format_enc_ciphers.str, i64 0, i64 0), i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 9, i1 false)
br label %5
5: ; preds = %4, %1
%6 = phi i8* [ getelementptr inbounds ([128 x i8], [128 x i8]* @format_enc_ciphers.str, i64 0, i64 8), %4 ], [ getelementptr inbounds ([128 x i8], [128 x i8]* @format_enc_ciphers.str, i64 0, i64 0), %1 ]
%7 = and i32 %0, 32
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %5
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(10) %6, i8* align 1 dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 10, i1 false)
%10 = getelementptr inbounds i8, i8* %6, i64 9
br label %11
11: ; preds = %9, %5
%12 = phi i8* [ %10, %9 ], [ %6, %5 ]
%13 = and i32 %0, 4
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %11
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(7) %12, i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 7, i1 false)
%16 = getelementptr inbounds i8, i8* %12, i64 6
br label %17
17: ; preds = %15, %11
%18 = phi i8* [ %16, %15 ], [ %12, %11 ]
%19 = and i32 %0, 16
%20 = icmp eq i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %17
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(7) %18, i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 7, i1 false)
%22 = getelementptr inbounds i8, i8* %18, i64 6
br label %23
23: ; preds = %21, %17
%24 = phi i8* [ %22, %21 ], [ %18, %17 ]
%25 = and i32 %0, 8
%26 = icmp eq i32 %25, 0
br i1 %26, label %29, label %27
27: ; preds = %23
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(7) %24, i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i64 7, i1 false)
%28 = getelementptr inbounds i8, i8* %24, i64 6
br label %29
29: ; preds = %27, %23
%30 = phi i8* [ %28, %27 ], [ %24, %23 ]
%31 = and i32 %0, 64
%32 = icmp eq i32 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %29
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(10) %30, i8* align 1 dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i64 10, i1 false)
%34 = getelementptr inbounds i8, i8* %30, i64 9
br label %35
35: ; preds = %33, %29
%36 = phi i8* [ %34, %33 ], [ %30, %29 ]
%37 = and i32 %0, 128
%38 = icmp eq i32 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %35
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(7) %36, i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i64 7, i1 false)
%40 = getelementptr inbounds i8, i8* %36, i64 6
br label %41
41: ; preds = %39, %35
%42 = phi i8* [ %40, %39 ], [ %36, %35 ]
%43 = icmp ne i32 %0, 0
%44 = and i32 %0, 1
%45 = icmp eq i32 %44, 0
%46 = and i1 %43, %45
br i1 %46, label %49, label %47
47: ; preds = %41
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(7) %42, i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i64 7, i1 false)
%48 = getelementptr inbounds i8, i8* %42, i64 6
br label %49
49: ; preds = %41, %47
%50 = phi i8* [ %48, %47 ], [ %42, %41 ]
%51 = getelementptr inbounds i8, i8* %50, i64 -2
store i8 0, i8* %51
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @format_enc_ciphers.str, i64 0, i64 0)
}