#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_suites(int suites) {
  static char str[64] = {0};
  char *pos = str;
  if (suites & (1 << 2))
    pos += sprintf(pos, "PSK/");
  if (suites & (1 << 1))
    pos += sprintf(pos, "802.1X/");
  if (!suites || (suites & (1 << 0)))
    pos += sprintf(pos, "NONE/");
  *(pos - 1) = 0;
  return str;
}


x86 assembly (clang, -O0):
<format_enc_suites>:
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    $0x4,%eax
cmp    $0x0,%eax
je     1155 <format_enc_suites+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    $0x2,%eax
cmp    $0x0,%eax
je     1184 <format_enc_suites+0x74>
mov    -0x10(%rbp),%rdi
lea    0xe96(%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     119d <format_enc_suites+0x8d>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11bd <format_enc_suites+0xad>
mov    -0x10(%rbp),%rdi
lea    0xe65(%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,-0x1(%rax)
lea    0x2e74(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_enc_suites>:
test   $0x4,%dil
jne    1115 <format_enc_suites+0x15>
lea    0x2f23(%rip),%rax
test   $0x2,%dil
jne    1133 <format_enc_suites+0x33>
jmp    1144 <format_enc_suites+0x44>
movb   $0x0,0x2f18(%rip)
movl   $0x2f4b5350,0x2f0a(%rip)
53 4b 2f
lea    0x2f07(%rip),%rax
test   $0x2,%dil
je     1144 <format_enc_suites+0x44>
movabs $0x2f58312e323038,%rcx
mov    %rcx,(%rax)
add    $0x7,%rax
test   %edi,%edi
je     114d <format_enc_suites+0x4d>
and    $0x1,%edi
je     115d <format_enc_suites+0x5d>
movw   $0x2f,0x4(%rax)
movl   $0x454e4f4e,(%rax)
add    $0x5,%rax
movb   $0x0,-0x1(%rax)
lea    0x2ec8(%rip),%rax
ret

LLVM IR (-O0):
@format_enc_suites.str = internal global [64 x i8] zeroinitializer
@.str = [5 x i8] c"PSK/\00"
@.str.1 = [8 x i8] c"802.1X/\00"
@.str.2 = [6 x i8] c"NONE/\00"
define i8* @format_enc_suites(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @format_enc_suites.str, i64 0, i64 0), i8** %3
%4 = load i32, i32* %2
%5 = and i32 %4, 4
%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 ([5 x i8], [5 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, 2
%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 ([8 x i8], [8 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 = icmp ne i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i32, i32* %2
%28 = and i32 %27, 1
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %26, %23
%31 = load i8*, i8** %3
%32 = call i32 @sprintf(i8* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%33 = load i8*, i8** %3
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds i8, i8* %33, i64 %34
store i8* %35, i8** %3
br label %36
36: ; preds = %30, %26
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i64 -1
store i8 0, i8* %38
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @format_enc_suites.str, i64 0, i64 0)
}

LLVM IR (-O2):
@format_enc_suites.str = internal global [64 x i8] zeroinitializer
@.str = [5 x i8] c"PSK/\00"
@.str.2 = [6 x i8] c"NONE/\00"
define i8* @format_enc_suites(i32 %0) {
%2 = and i32 %0, 4
%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(5) getelementptr inbounds ([64 x i8], [64 x i8]* @format_enc_suites.str, i64 0, i64 0), i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 5, i1 false)
br label %5
5: ; preds = %4, %1
%6 = phi i8* [ getelementptr inbounds ([64 x i8], [64 x i8]* @format_enc_suites.str, i64 0, i64 4), %4 ], [ getelementptr inbounds ([64 x i8], [64 x i8]* @format_enc_suites.str, i64 0, i64 0), %1 ]
%7 = and i32 %0, 2
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = bitcast i8* %6 to i64*
store i64 13326292157083704, i64* %10
%11 = getelementptr inbounds i8, i8* %6, i64 7
br label %12
12: ; preds = %9, %5
%13 = phi i8* [ %11, %9 ], [ %6, %5 ]
%14 = icmp ne i32 %0, 0
%15 = and i32 %0, 1
%16 = icmp eq i32 %15, 0
%17 = and i1 %14, %16
br i1 %17, label %20, label %18
18: ; preds = %12
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %13, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 6, i1 false)
%19 = getelementptr inbounds i8, i8* %13, i64 5
br label %20
20: ; preds = %12, %18
%21 = phi i8* [ %19, %18 ], [ %13, %12 ]
%22 = getelementptr inbounds i8, i8* %21, i64 -1
store i8 0, i8* %22
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @format_enc_suites.str, i64 0, i64 0)
}