#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 */
scalar_t__ ccnl_isSuite(unsigned char);
int /*<<< orphan*/ printf(char *, unsigned char);
void print_value(int offset, unsigned char *valptr, int vallen) {
  int i;
  if (vallen == 1 && ccnl_isSuite(valptr[0])) {
    printf("%u", valptr[0]);
  } else {
    for (i = 0; i < vallen; ++i) {
      printf("%c", valptr[i]);
    }
  }
}


x86 assembly (clang, -O0):
<print_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    116a <print_value+0x4a>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <ccnl_isSuite@plt>
cmp    $0x0,%rax
je     116a <print_value+0x4a>
mov    -0x10(%rbp),%rax
lea    0xea3(%rip),%rdi
movzbl (%rax),%esi
call   1040 <printf@plt>
jmp    11a8 <print_value+0x88>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a3 <print_value+0x83>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
lea    0xe77(%rip),%rdi
movzbl (%rax,%rcx,1),%esi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1171 <print_value+0x51>
jmp    11a8 <print_value+0x88>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_value>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r15
cmp    $0x1,%edx
jne    1159 <print_value+0x39>
movzbl (%r15),%edi
call   1030 <ccnl_isSuite@plt>
test   %rax,%rax
je     115b <print_value+0x3b>
movzbl (%r15),%esi
lea    0xeb6(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
jl     1186 <print_value+0x66>
mov    %ebp,%ebp
xor    %ebx,%ebx
lea    0xe9d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <print_value+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
@.str.1 = [3 x i8] c"%c\00"
define void @print_value(i32 %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 1
br i1 %4, label %5, label %12
5: ; preds = %3
%6 = load i8, i8* %1
%7 = tail call i64 @ccnl_isSuite(i8 zeroext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = load i8, i8* %1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 zeroext %10)
br label %23
12: ; preds = %3
%13 = icmp sgt i32 %2, 0
br i1 %13, label %14, label %23
14: ; preds = %5, %12
%15 = zext i32 %2 to i64
br label %16
16: ; preds = %14, %16
%17 = phi i64 [ 0, %14 ], [ %21, %16 ]
%18 = getelementptr inbounds i8, i8* %1, i64 %17
%19 = load i8, i8* %18
%20 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %19)
%21 = add nuw nsw i64 %17, 1
%22 = icmp eq i64 %21, %15
br i1 %22, label %23, label %16
23: ; preds = %16, %12, %9
ret void
}