#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*/ STDERR_FILENO;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void printsysparam(void *data, int len) {
  unsigned char *x = data;
  int i;
  for (i = 0; i < len; i++) {
    if ((x[i] < ' ') || (x[1] > 127))
      goto printhex;
  }
  write(STDERR_FILENO, "\"", 1);
  write(STDERR_FILENO, data, len);
  write(STDERR_FILENO, "\"\n", 2);
  return;
printhex:
  fprintf(stderr, "[");
  for (i = 0; i < len; i++)
    fprintf(stderr, " %02x", x[i]);
  fprintf(stderr, " ]\n");
}


x86 assembly (clang, -O0):
<printsysparam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1188 <printsysparam+0x68>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jl     1170 <printsysparam+0x50>
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x7f,%eax
jle    1175 <printsysparam+0x55>
jmp    11d6 <printsysparam+0xb6>
jmp    117a <printsysparam+0x5a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113e <printsysparam+0x1e>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <write@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xe3b(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
jmp    1248 <printsysparam+0x128>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1231 <printsysparam+0x111>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f4 <printsysparam+0xd4>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
lea    0xdcc(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printsysparam>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
test   %esi,%esi
jle    1155 <printsysparam+0x35>
mov    %r14d,%r12d
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x20,(%rbx,%rax,1)
jb     119a <printsysparam+0x7a>
cmpb   $0x0,0x1(%rbx)
js     119a <printsysparam+0x7a>
add    $0x1,%rax
cmp    %rax,%r12
jne    1140 <printsysparam+0x20>
mov    0x2e7c(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe9a(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <write@plt>
mov    0x0(%rbp),%edi
lea    0xe7a(%rip),%rsi
mov    $0x2,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <write@plt>
mov    0x2e3f(%rip),%r15
mov    (%r15),%edi
lea    0xe5a(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xe4e(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%r15),%edi
movzbl (%rbx,%rbp,1),%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    11c0 <printsysparam+0xa0>
mov    (%r15),%edi
lea    0xe29(%rip),%rsi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@STDERR_FILENO = global i32 0
@.str = [2 x i8] c"\22\00"
@.str.1 = [3 x i8] c"\22\0A\00"
@stderr = global i32 0
@.str.2 = [2 x i8] c"[\00"
@.str.3 = [6 x i8] c" %02x\00"
@.str.4 = [4 x i8] c" ]\0A\00"
define void @printsysparam(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
store i32 0, i32* %6
br label %8
8: ; preds = %28, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %31
12: ; preds = %8
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = icmp slt i32 %18, 32
br i1 %19, label %26, label %20
20: ; preds = %12
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = icmp sgt i32 %24, 127
br i1 %25, label %26, label %27
26: ; preds = %20, %12
br label %40
27: ; preds = %20
br label %28
28: ; preds = %27
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %8
31: ; preds = %8
%32 = load i32, i32* @STDERR_FILENO
%33 = call i32 @write(i32 %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%34 = load i32, i32* @STDERR_FILENO
%35 = load i8*, i8** %3
%36 = load i32, i32* %4
%37 = call i32 @write(i32 %34, i8* %35, i32 %36)
%38 = load i32, i32* @STDERR_FILENO
%39 = call i32 @write(i32 %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
br label %62
40: ; preds = %26
%41 = load i32, i32* @stderr
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %43
43: ; preds = %56, %40
%44 = load i32, i32* %6
%45 = load i32, i32* %4
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %59
47: ; preds = %43
%48 = load i32, i32* @stderr
%49 = load i8*, i8** %5
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %47
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
store i32 %58, i32* %6
br label %43
59: ; preds = %43
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %62
62: ; preds = %59, %31
ret void
}

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