#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void print_layout(const char *layout, size_t len) {
  for (size_t i = 0; i <= len; ++i) {
    fprintf(stderr, "%c", layout[i]);
    if ((len - i) % 10 == 0)
      fprintf(stderr, "\n");
  }
}


x86 assembly (clang, -O0):
<print_layout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     11a2 <print_layout+0x92>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edx
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
sub    -0x18(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    118c <print_layout+0x7c>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
lea    0xe7e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1191 <print_layout+0x81>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <print_layout+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_layout>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    0x2eb8(%rip),%r12
mov    %rsi,%rbx
xor    %ebp,%ebp
jmp    113d <print_layout+0x2d>
nop
add    $0x1,%rbp
add    $0xffffffffffffffff,%rbx
cmp    %r15,%rbp
ja     118f <print_layout+0x7f>
mov    %rbx,%rax
movabs $0xcccccccccccccccd,%rcx
cc cc cc
mul    %rcx
shr    $0x2,%rdx
and    $0xfffffffffffffffe,%rdx
lea    (%rdx,%rdx,4),%rax
mov    %r15,%r13
sub    %rax,%r13
mov    (%r12),%edi
movsbl (%r14,%rbp,1),%edx
lea    0xe91(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    %rbp,%r13
jne    1130 <print_layout+0x20>
mov    (%r12),%edi
lea    0xe7d(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    1130 <print_layout+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_layout(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %27, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ule i64 %7, %8
br i1 %9, label %10, label %30
10: ; preds = %6
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %3
%13 = load i64, i64* %5
%14 = getelementptr inbounds i8, i8* %12, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i64, i64* %4
%19 = load i64, i64* %5
%20 = sub i64 %18, %19
%21 = urem i64 %20, 10
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %10
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %23, %10
br label %27
27: ; preds = %26
%28 = load i64, i64* %5
%29 = add i64 %28, 1
store i64 %29, i64* %5
br label %6
30: ; preds = %6
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_layout(i8* nocapture %0, i64 %1) {
br label %4
3: ; preds = %17
ret void
4: ; preds = %2, %17
%5 = phi i64 [ 0, %2 ], [ %18, %17 ]
%6 = load i32, i32* @stderr
%7 = getelementptr inbounds i8, i8* %0, i64 %5
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = sub i64 %1, %5
%12 = urem i64 %11, 10
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %4
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %4, %14
%18 = add i64 %5, 1
%19 = icmp ugt i64 %18, %1
br i1 %19, label %3, label %4
}