#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 *, ...);
int strlen(char *);
void print_shell(char *data) {
  int i, l = 15;
  for (i = 0; i < strlen(data); ++i) {
    if (l >= 15) {
      if (i)
        printf(" \"\n");
      printf("\t\"");
      l = 0;
    }
    ++l;
    printf("\\x %02x", ((unsigned char *)data)[i]);
  }
  printf(" \";\ n\n\n");
}


x86 assembly (clang, -O0):
<print_shell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xf,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jge    11be <print_shell+0x9e>
cmpl   $0xf,-0x10(%rbp)
jl     118d <print_shell+0x6d>
cmpl   $0x0,-0xc(%rbp)
je     1178 <print_shell+0x58>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <print_shell+0x1a>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_shell>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
call   1040 <strlen@plt>
test   %eax,%eax
jle    11e1 <print_shell+0xb1>
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzbl 0x0(%r13),%esi
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     11e1 <print_shell+0xb1>
mov    $0x1,%ebp
mov    $0x1,%ebx
lea    0xe88(%rip),%r14
lea    0xe6f(%rip),%r15
lea    0xe6b(%rip),%r12
jmp    11c6 <print_shell+0x96>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
movzbl 0x0(%r13,%rbx,1),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
mov    %r13,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11e1 <print_shell+0xb1>
cmp    $0xf,%ebp
jl     11a0 <print_shell+0x70>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11a0 <print_shell+0x70>
lea    0xe23(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"\09\22\00"
@.str.2 = [8 x i8] c"\\x %02x\00"
@str = [7 x i8] c" \22; n\0A\00"
@str.4 = [3 x i8] c" \22\00"
define void @print_shell(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %29
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = load i8, i8* %0
%7 = zext i8 %6 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 @strlen(i8* %0)
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %29
11: ; preds = %4, %18
%12 = phi i64 [ %25, %18 ], [ 1, %4 ]
%13 = phi i32 [ %20, %18 ], [ 1, %4 ]
%14 = icmp sgt i32 %13, 14
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %15, %11
%19 = phi i32 [ 0, %15 ], [ %13, %11 ]
%20 = add nsw i32 %19, 1
%21 = getelementptr inbounds i8, i8* %0, i64 %12
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i64 %12, 1
%26 = tail call i32 @strlen(i8* %0)
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %25, %27
br i1 %28, label %11, label %29
29: ; preds = %18, %4, %1
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}