#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 *, ...);
void stringdump(void *d, size_t len) {
  unsigned char *s;
  printf("====================================================================="
         "==\n");
  for (s = d; len; len--, s++)
    printf("%c", *s);
  printf("\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
         "^^^^\n");
}


x86 assembly (clang, -O0):
<stringdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1173 <stringdump+0x63>
mov    -0x18(%rbp),%rax
movzbl (%rax),%esi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1136 <stringdump+0x26>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringdump>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
test   %r15,%r15
je     1153 <stringdump+0x33>
xor    %ebx,%ebx
xchg   %ax,%ax
movzbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <stringdump+0x20>
lea    0xeee(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [73 x i8] c"=======================================================================\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [74 x i8] c"\0A^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\0A\00"
define void @stringdump(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %3
store i8* %7, i8** %5
br label %8
8: ; preds = %16, %2
%9 = load i64, i64* %4
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %11
%17 = load i64, i64* %4
%18 = add i64 %17, -1
store i64 %18, i64* %4
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %5
br label %8
21: ; preds = %8
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [72 x i8] c"=======================================================================\00"
@str.3 = [73 x i8] c"\0A^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\00"
define void @stringdump(i8* nocapture %0, i64 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
%4 = icmp eq i64 %1, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %12, %5 ], [ %0, %2 ]
%7 = phi i64 [ %11, %5 ], [ %1, %2 ]
%8 = load i8, i8* %6
%9 = zext i8 %8 to i32
%10 = tail call i32 @putchar(i32 %9)
%11 = add i64 %7, -1
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = icmp eq i64 %11, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %2
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.3, i64 0, i64 0))
ret void
}