#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 *, char *);
void decode_bits(unsigned char bits, char *icon[]) {
  for (int i = 0; i < 8; i++) {
    if (bits & 1) {
      printf("%s", icon[i]);
    }
    bits = bits >> 1;
  }
}


x86 assembly (clang, -O0):
<decode_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1173 <decode_bits+0x63>
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     115b <decode_bits+0x4b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x1(%rbp),%eax
sar    $0x1,%eax
mov    %al,-0x1(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <decode_bits+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_bits>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
test   $0x1,%bpl
jne    115a <decode_bits+0x4a>
test   $0x2,%bpl
jne    116f <decode_bits+0x5f>
test   $0x4,%bpl
jne    1185 <decode_bits+0x75>
test   $0x8,%bpl
jne    119b <decode_bits+0x8b>
test   $0x10,%bpl
jne    11b1 <decode_bits+0xa1>
test   $0x20,%bpl
jne    11cb <decode_bits+0xbb>
test   $0x40,%bpl
jne    11e5 <decode_bits+0xd5>
test   %bpl,%bpl
js     11fe <decode_bits+0xee>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    (%rbx),%rsi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
test   $0x2,%bpl
je     1124 <decode_bits+0x14>
mov    0x8(%rbx),%rsi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
test   $0x4,%bpl
je     112a <decode_bits+0x1a>
mov    0x10(%rbx),%rsi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
test   $0x8,%bpl
je     1130 <decode_bits+0x20>
mov    0x18(%rbx),%rsi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
test   $0x10,%bpl
je     1136 <decode_bits+0x26>
mov    0x20(%rbx),%rsi
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
test   $0x20,%bpl
je     1140 <decode_bits+0x30>
mov    0x28(%rbx),%rsi
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
test   $0x40,%bpl
je     114a <decode_bits+0x3a>
mov    0x30(%rbx),%rsi
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
test   %bpl,%bpl
jns    1153 <decode_bits+0x43>
mov    0x38(%rbx),%rsi
lea    0xdf7(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @decode_bits(i8 zeroext %0, i8** %1) {
%3 = alloca i8
%4 = alloca i8**
%5 = alloca i32
store i8 %0, i8* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
br label %6
6: ; preds = %26, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 8
br i1 %8, label %9, label %29
9: ; preds = %6
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = load i8**, i8*** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %14, %9
%22 = load i8, i8* %3
%23 = zext i8 %22 to i32
%24 = ashr i32 %23, 1
%25 = trunc i32 %24 to i8
store i8 %25, i8* %3
br label %26
26: ; preds = %21
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %6
29: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @decode_bits(i8 zeroext %0, i8** nocapture %1) {
%3 = and i8 %0, 1
%4 = icmp eq i8 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %5, %2
%9 = and i8 %0, 2
%10 = icmp eq i8 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %11, %8
%16 = and i8 %0, 4
%17 = icmp eq i8 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %18, %15
%23 = and i8 %0, 8
%24 = icmp eq i8 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %22
%26 = getelementptr inbounds i8*, i8** %1, i64 3
%27 = load i8*, i8** %26
%28 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %25, %22
%30 = and i8 %0, 16
%31 = icmp eq i8 %30, 0
br i1 %31, label %36, label %32
32: ; preds = %29
%33 = getelementptr inbounds i8*, i8** %1, i64 4
%34 = load i8*, i8** %33
%35 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %32, %29
%37 = and i8 %0, 32
%38 = icmp eq i8 %37, 0
br i1 %38, label %43, label %39
39: ; preds = %36
%40 = getelementptr inbounds i8*, i8** %1, i64 5
%41 = load i8*, i8** %40
%42 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %39, %36
%44 = and i8 %0, 64
%45 = icmp eq i8 %44, 0
br i1 %45, label %50, label %46
46: ; preds = %43
%47 = getelementptr inbounds i8*, i8** %1, i64 6
%48 = load i8*, i8** %47
%49 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %46, %43
%51 = icmp sgt i8 %0, -1
br i1 %51, label %56, label %52
52: ; preds = %50
%53 = getelementptr inbounds i8*, i8** %1, i64 7
%54 = load i8*, i8** %53
%55 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %52, %50
ret void
}