#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(int, char *, ...);
int decode_symbol(unsigned char *element, int element_len) {
  int c;
  lprintf(14, "Symbol: ");
  for (c = 0; c < element_len; c++) {
    if (c > 0)
      lprintf(14, ".");
    lprintf(14, "%d", element[c] >> 4);
    if (element[c] & 0x0f)
      lprintf(14, ".%d", element[c] & 0x0f);
  }
  lprintf(14, "\r\n");
  return 0;
}


x86 assembly (clang, -O0):
<decode_symbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0xe,%edi
lea    0xed5(%rip),%rsi
mov    $0x0,%al
call   1030 <lprintf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d1 <decode_symbol+0xc1>
cmpl   $0x0,-0x10(%rbp)
jle    1162 <decode_symbol+0x52>
mov    $0xe,%edi
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <lprintf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
sar    $0x4,%edx
mov    $0xe,%edi
lea    0xe8f(%rip),%rsi
mov    $0x0,%al
call   1030 <lprintf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
and    $0xf,%eax
cmp    $0x0,%eax
je     11be <decode_symbol+0xae>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
and    $0xf,%edx
mov    $0xe,%edi
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1030 <lprintf@plt>
jmp    11c3 <decode_symbol+0xb3>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1139 <decode_symbol+0x29>
mov    $0xe,%edi
lea    0xe32(%rip),%rsi
mov    $0x0,%al
call   1030 <lprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_symbol>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed9(%rip),%rsi
mov    $0xe,%edi
xor    %eax,%eax
call   1030 <lprintf@plt>
test   %ebp,%ebp
jle    1170 <decode_symbol+0x60>
movzbl (%rbx),%edx
shr    $0x4,%edx
lea    0xec8(%rip),%rsi
mov    $0xe,%edi
xor    %eax,%eax
call   1030 <lprintf@plt>
movzbl (%rbx),%edx
and    $0xf,%edx
je     116b <decode_symbol+0x5b>
lea    0xeac(%rip),%rsi
mov    $0xe,%edi
xor    %eax,%eax
call   1030 <lprintf@plt>
cmp    $0x1,%ebp
jne    1194 <decode_symbol+0x84>
lea    0xe98(%rip),%rsi
mov    $0xe,%edi
xor    %eax,%eax
call   1030 <lprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%r13d
mov    $0x1,%ebp
lea    0xe66(%rip),%r14
lea    0xe62(%rip),%r12
lea    0xe5a(%rip),%r15
jmp    11c9 <decode_symbol+0xb9>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbp
cmp    %rbp,%r13
je     1170 <decode_symbol+0x60>
mov    $0xe,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <lprintf@plt>
movzbl (%rbx,%rbp,1),%edx
shr    $0x4,%edx
mov    $0xe,%edi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <lprintf@plt>
movzbl (%rbx,%rbp,1),%edx
and    $0xf,%edx
je     11c0 <decode_symbol+0xb0>
mov    $0xe,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <lprintf@plt>
jmp    11c0 <decode_symbol+0xb0>

LLVM IR (-O0):
@.str = [9 x i8] c"Symbol: \00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c".%d\00"
@.str.4 = [3 x i8] c"\0D\0A\00"
define i32 @decode_symbol(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %7
7: ; preds = %43, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %46
11: ; preds = %7
%12 = load i32, i32* %5
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = load i8*, i8** %3
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = ashr i32 %22, 4
%24 = call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = load i8*, i8** %3
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = and i32 %30, 15
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %42
33: ; preds = %16
%34 = load i8*, i8** %3
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = load i8, i8* %37
%39 = zext i8 %38 to i32
%40 = and i32 %39, 15
%41 = call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %33, %16
br label %43
43: ; preds = %42
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %7
46: ; preds = %7
%47 = call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Symbol: \00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c".%d\00"
@.str.4 = [3 x i8] c"\0D\0A\00"
define i32 @decode_symbol(i8* nocapture %0, i32 %1) {
%3 = tail call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %36
5: ; preds = %2
%6 = zext i32 %1 to i64
%7 = load i8, i8* %0
%8 = lshr i8 %7, 4
%9 = zext i8 %8 to i32
%10 = tail call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i8, i8* %0
%12 = and i8 %11, 15
%13 = icmp eq i8 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %5
%15 = zext i8 %12 to i32
%16 = tail call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %5
%18 = icmp eq i32 %1, 1
br i1 %18, label %36, label %19
19: ; preds = %17, %33
%20 = phi i64 [ %34, %33 ], [ 1, %17 ]
%21 = tail call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = getelementptr inbounds i8, i8* %0, i64 %20
%23 = load i8, i8* %22
%24 = lshr i8 %23, 4
%25 = zext i8 %24 to i32
%26 = tail call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = load i8, i8* %22
%28 = and i8 %27, 15
%29 = icmp eq i8 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %19
%31 = zext i8 %28 to i32
%32 = tail call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %19, %30
%34 = add nuw nsw i64 %20, 1
%35 = icmp eq i64 %34, %6
br i1 %35, label %36, label %19
36: ; preds = %33, %17, %2
%37 = tail call i32 (i32, i8*, ...) @lprintf(i32 14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}