#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 */
char *get_profile_str(int, char *);
int /*<<< orphan*/ printf(char *, ...);
void decode_get_config_feature(int feature, unsigned char *ucp, int len) {
  int k, profile;
  char buff[128];
  switch (feature) {
  case 0:
    printf("Available profiles, profile of current media marked "
           "with * \n");
    for (k = 4; k < len; k += 4) {
      profile = (ucp[k] << 8) + ucp[k + 1];
      printf("    %s   %s\n", get_profile_str(profile, buff),
             ((ucp[k + 2] & 1) ? "*" : ""));
    }
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<decode_get_config_feature>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
test   %eax,%eax
jne    11e7 <decode_get_config_feature+0xc7>
jmp    1145 <decode_get_config_feature+0x25>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x4,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e2 <decode_get_config_feature+0xc2>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0xa0(%rbp),%rsi
call   1040 <get_profile_str@plt>
mov    %rax,%rsi
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%ecx
and    $0x1,%ecx
lea    0xe84(%rip),%rdx
lea    0xe8b(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x18(%rbp)
jmp    115a <decode_get_config_feature+0x3a>
jmp    11ec <decode_get_config_feature+0xcc>
jmp    11ec <decode_get_config_feature+0xcc>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_get_config_feature>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
test   %edi,%edi
jne    11b3 <decode_get_config_feature+0x83>
mov    %edx,%r12d
mov    %rsi,%rbx
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x5,%r12d
jl     11b3 <decode_get_config_feature+0x83>
mov    $0x4,%ebp
lea    0xea3(%rip),%r13
lea    0xe9d(%rip),%r14
lea    0xe89(%rip),%r15
nopw   0x0(%rax,%rax,1)
movzwl (%rbx,%rbp,1),%edi
shl    $0x10,%edi
bswap  %edi
mov    %rsp,%rsi
call   1050 <get_profile_str@plt>
testb  $0x1,0x2(%rbx,%rbp,1)
mov    %r14,%rdx
cmove  %r13,%rdx
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x4,%rbp
cmp    %r12d,%ebp
jl     1180 <decode_get_config_feature+0x50>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [61 x i8] c"Available profiles, profile of current media marked with * \0A\00"
@.str.1 = [13 x i8] c" %s %s\0A\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [1 x i8] zeroinitializer
define void @decode_get_config_feature(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [128 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
switch i32 %10, label %52 [
i32 0, label %11
]
11: ; preds = %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
store i32 4, i32* %7
br label %13
13: ; preds = %48, %11
%14 = load i32, i32* %7
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %51
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = shl i32 %23, 8
%25 = load i8*, i8** %5
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %25, i64 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = add nsw i32 %24, %31
store i32 %32, i32* %8
%33 = load i32, i32* %8
%34 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%35 = call i8* @get_profile_str(i32 %33, i8* %34)
%36 = load i8*, i8** %5
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %36, i64 %39
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = and i32 %42, 1
%44 = icmp ne i32 %43, 0
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %35, i8* %46)
br label %48
48: ; preds = %17
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 4
store i32 %50, i32* %7
br label %13
51: ; preds = %13
br label %53
52: ; preds = %3
br label %53
53: ; preds = %52, %51
ret void
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c" %s %s\0A\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [1 x i8] zeroinitializer
@str = [60 x i8] c"Available profiles, profile of current media marked with * \00"
define void @decode_get_config_feature(i32 %0, i8* nocapture %1, i32 %2) {
%4 = alloca [128 x i8]
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%6 = icmp eq i32 %0, 0
br i1 %6, label %7, label %32
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
%9 = icmp sgt i32 %2, 4
br i1 %9, label %10, label %32
10: ; preds = %7, %10
%11 = phi i64 [ %29, %10 ], [ 4, %7 ]
%12 = getelementptr inbounds i8, i8* %1, i64 %11
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = shl nuw nsw i32 %14, 8
%16 = or i64 %11, 1
%17 = getelementptr inbounds i8, i8* %1, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = or i32 %15, %19
%21 = call i8* @get_profile_str(i32 %20, i8* %5)
%22 = or i64 %11, 2
%23 = getelementptr inbounds i8, i8* %1, i64 %22
%24 = load i8, i8* %23
%25 = and i8 %24, 1
%26 = icmp eq i8 %25, 0
%27 = select i1 %26, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %27)
%29 = add nuw i64 %11, 4
%30 = trunc i64 %29 to i32
%31 = icmp slt i32 %30, %2
br i1 %31, label %10, label %32
32: ; preds = %10, %7, %3
ret void
}