#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*/ ft_putchar(unsigned char);
int /*<<< orphan*/ print_hex_memory(unsigned int *, unsigned char *,
                                    unsigned int);
void print_string(unsigned char *src, unsigned int size) {
  unsigned int it;
  it = 0;
  while (it < 16)
    print_hex_memory(&it, src, size);
  ft_putchar(' ');
  it = 0;
  while (it < 16 && it < size) {
    if (src[it] <= 31)
      ft_putchar('.');
    else
      ft_putchar(src[it]);
    if (it + 1 < size && src[it + 1] <= 31)
      ft_putchar('.');
    else if (it + 1 < size)
      ft_putchar(src[it + 1]);
    it += 2;
  }
}


x86 assembly (clang, -O0):
<print_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jae    1155 <print_string+0x35>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    -0x10(%rbp),%rdi
call   1030 <print_hex_memory@plt>
jmp    1136 <print_string+0x16>
mov    $0x20,%edi
call   1040 <ft_putchar@plt>
movl   $0x0,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x10,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jae    1181 <print_string+0x61>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
setb   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1191 <print_string+0x71>
jmp    1232 <print_string+0x112>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
cmp    $0x1f,%eax
jg     11b4 <print_string+0x94>
mov    $0x2e,%edi
call   1040 <ft_putchar@plt>
jmp    11c4 <print_string+0xa4>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movzbl (%rax,%rcx,1),%edi
call   1040 <ft_putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jae    11fb <print_string+0xdb>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
cmp    $0x1f,%eax
jg     11fb <print_string+0xdb>
mov    $0x2e,%edi
call   1040 <ft_putchar@plt>
jmp    1224 <print_string+0x104>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jae    121f <print_string+0xff>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%edi
call   1040 <ft_putchar@plt>
jmp    1224 <print_string+0x104>
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
jmp    1166 <print_string+0x46>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_string>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%r15
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <print_hex_memory@plt>
cmpl   $0x10,0x4(%rsp)
jb     1140 <print_string+0x20>
mov    $0x20,%edi
call   1040 <ft_putchar@plt>
movl   $0x0,0x4(%rsp)
test   %ebx,%ebx
je     11c7 <print_string+0xa7>
xor    %eax,%eax
mov    $0x2e,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%eax
movzbl (%r14,%rax,1),%eax
cmp    $0x20,%al
cmovb  %ebp,%eax
movzbl %al,%edi
call   1040 <ft_putchar@plt>
mov    0x4(%rsp),%eax
add    $0x1,%eax
cmp    %ebx,%eax
jae    11b3 <print_string+0x93>
mov    %eax,%eax
movzbl (%r14,%rax,1),%eax
cmp    $0x20,%al
cmovb  %ebp,%eax
movzbl %al,%edi
call   1040 <ft_putchar@plt>
mov    0x4(%rsp),%eax
add    $0x2,%eax
mov    %eax,0x4(%rsp)
cmp    $0xf,%eax
ja     11c7 <print_string+0xa7>
cmp    %ebx,%eax
jb     1180 <print_string+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @print_string(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %9, %2
%7 = load i32, i32* %5
%8 = icmp ult i32 %7, 16
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = call i32 @print_hex_memory(i32* %5, i8* %10, i32 %11)
br label %6
13: ; preds = %6
%14 = call i32 @ft_putchar(i8 zeroext 32)
store i32 0, i32* %5
br label %15
15: ; preds = %71, %13
%16 = load i32, i32* %5
%17 = icmp ult i32 %16, 16
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = icmp ult i32 %19, %20
br label %22
22: ; preds = %18, %15
%23 = phi i1 [ false, %15 ], [ %21, %18 ]
br i1 %23, label %24, label %74
24: ; preds = %22
%25 = load i8*, i8** %3
%26 = load i32, i32* %5
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = icmp sle i32 %30, 31
br i1 %31, label %32, label %34
32: ; preds = %24
%33 = call i32 @ft_putchar(i8 zeroext 46)
br label %41
34: ; preds = %24
%35 = load i8*, i8** %3
%36 = load i32, i32* %5
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = call i32 @ft_putchar(i8 zeroext %39)
br label %41
41: ; preds = %34, %32
%42 = load i32, i32* %5
%43 = add i32 %42, 1
%44 = load i32, i32* %4
%45 = icmp ult i32 %43, %44
br i1 %45, label %46, label %57
46: ; preds = %41
%47 = load i8*, i8** %3
%48 = load i32, i32* %5
%49 = add i32 %48, 1
%50 = zext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %47, i64 %50
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = icmp sle i32 %53, 31
br i1 %54, label %55, label %57
55: ; preds = %46
%56 = call i32 @ft_putchar(i8 zeroext 46)
br label %71
57: ; preds = %46, %41
%58 = load i32, i32* %5
%59 = add i32 %58, 1
%60 = load i32, i32* %4
%61 = icmp ult i32 %59, %60
br i1 %61, label %62, label %70
62: ; preds = %57
%63 = load i8*, i8** %3
%64 = load i32, i32* %5
%65 = add i32 %64, 1
%66 = zext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %63, i64 %66
%68 = load i8, i8* %67
%69 = call i32 @ft_putchar(i8 zeroext %68)
br label %70
70: ; preds = %62, %57
br label %71
71: ; preds = %70, %55
%72 = load i32, i32* %5
%73 = add i32 %72, 2
store i32 %73, i32* %5
br label %15
74: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @print_string(i8* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %2, %5
%6 = call i32 @print_hex_memory(i32* %3, i8* %0, i32 %1)
%7 = load i32, i32* %3
%8 = icmp ult i32 %7, 16
br i1 %8, label %5, label %9
9: ; preds = %5
%10 = call i32 @ft_putchar(i8 zeroext 32)
store i32 0, i32* %3
%11 = icmp eq i32 %1, 0
br i1 %11, label %36, label %12
12: ; preds = %9, %30
%13 = phi i32 [ %32, %30 ], [ 0, %9 ]
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = icmp ult i8 %16, 32
%18 = select i1 %17, i8 46, i8 %16
%19 = call i32 @ft_putchar(i8 zeroext %18)
%20 = load i32, i32* %3
%21 = add i32 %20, 1
%22 = icmp ult i32 %21, %1
br i1 %22, label %23, label %30
23: ; preds = %12
%24 = zext i32 %21 to i64
%25 = getelementptr inbounds i8, i8* %0, i64 %24
%26 = load i8, i8* %25
%27 = icmp ult i8 %26, 32
%28 = select i1 %27, i8 46, i8 %26
%29 = call i32 @ft_putchar(i8 zeroext %28)
br label %30
30: ; preds = %23, %12
%31 = load i32, i32* %3
%32 = add i32 %31, 2
store i32 %32, i32* %3
%33 = icmp ult i32 %32, 16
%34 = icmp ult i32 %32, %1
%35 = and i1 %33, %34
br i1 %35, label %12, label %36
36: ; preds = %30, %9
ret void
}