#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*/ my_putchar(char);
int /*<<< orphan*/ my_showmem_line_addr(long, char *, int, int);
int /*<<< orphan*/ my_showmem_line_hex(char *, int);
void my_showmem_line(char *str, int size) {
  int i;
  my_showmem_line_addr((long)str, "0123456789abcdef", 16, 8);
  my_showmem_line_hex(str, size);
  my_putchar(' ');
  i = 0;
  while (i < size) {
    my_putchar(str[i]);
    i = i + 1;
  }
  my_putchar('\n');
}


x86 assembly (clang, -O0):
<my_showmem_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x10,%edx
mov    $0x8,%ecx
call   1030 <my_showmem_line_addr@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <my_showmem_line_hex@plt>
mov    $0x20,%edi
call   1040 <my_putchar@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a1 <my_showmem_line+0x71>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <my_putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1176 <my_showmem_line+0x46>
mov    $0xa,%edi
call   1040 <my_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_showmem_line>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xec0(%rip),%rsi
mov    $0x10,%edx
mov    $0x8,%ecx
call   1030 <my_showmem_line_addr@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1050 <my_showmem_line_hex@plt>
mov    $0x20,%edi
call   1040 <my_putchar@plt>
test   %ebp,%ebp
jle    1183 <my_showmem_line+0x53>
mov    %ebp,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1040 <my_putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <my_showmem_line+0x40>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <my_putchar@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"0123456789abcdef\00"
define void @my_showmem_line(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i64
%8 = call i32 @my_showmem_line_addr(i64 %7, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 16, i32 8)
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = call i32 @my_showmem_line_hex(i8* %9, i32 %10)
%12 = call i32 @my_putchar(i8 signext 32)
store i32 0, i32* %5
br label %13
13: ; preds = %17, %2
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = load i8*, i8** %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = call i32 @my_putchar(i8 signext %22)
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %13
26: ; preds = %13
%27 = call i32 @my_putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789abcdef\00"
define void @my_showmem_line(i8* %0, i32 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = tail call i32 @my_showmem_line_addr(i64 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 16, i32 8)
%5 = tail call i32 @my_showmem_line_hex(i8* %0, i32 %1)
%6 = tail call i32 @my_putchar(i8 signext 32)
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %15, %10 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = tail call i32 @my_putchar(i8 signext %13)
%15 = add nuw nsw i64 %11, 1
%16 = icmp eq i64 %15, %9
br i1 %16, label %17, label %10
17: ; preds = %10, %2
%18 = tail call i32 @my_putchar(i8 signext 10)
ret void
}