#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*/ memset(char *, char, size_t);
int /*<<< orphan*/ print_func(void const *, int /*<<< orphan*/, char *, size_t);
void fill_gap_pos(const void *data, size_t from, size_t to) {
  if (to > from) {
    char gap[to - from + 1];
    memset(gap, ' ', to - from);
    gap[to - from] = '\0';
    print_func(data, ~0, gap, from);
  }
}


x86 assembly (clang, -O0):
<fill_gap_pos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    11af <fill_gap_pos+0x8f>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
sub    %rax,%rcx
mov    %rcx,%rax
add    $0x1,%rax
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
add    $0x10,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdx
sub    -0x10(%rbp),%rdx
mov    $0x20,%esi
call   1040 <memset@plt>
mov    -0x30(%rbp),%rdx
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
movb   $0x0,(%rdx,%rax,1)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0xffffffff,%esi
call   1030 <print_func@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_gap_pos>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
sub    %rsi,%rbx
jbe    117b <fill_gap_pos+0x5b>
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsp,%r13
lea    0x10(%rbx),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
mov    %r12,%rdi
mov    $0x20,%esi
mov    %rbx,%rdx
call   1040 <memset@plt>
movb   $0x0,(%rbx,%r12,1)
mov    %r14,%rdi
mov    $0xffffffff,%esi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <print_func@plt>
mov    %r13,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fill_gap_pos(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%9 = load i64, i64* %6
%10 = load i64, i64* %5
%11 = icmp ugt i64 %9, %10
br i1 %11, label %12, label %31
12: ; preds = %3
%13 = load i64, i64* %6
%14 = load i64, i64* %5
%15 = sub i64 %13, %14
%16 = add i64 %15, 1
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %7
%18 = alloca i8, i64 %16
store i64 %16, i64* %8
%19 = load i64, i64* %6
%20 = load i64, i64* %5
%21 = sub i64 %19, %20
%22 = call i32 @memset(i8* %18, i8 signext 32, i64 %21)
%23 = load i64, i64* %6
%24 = load i64, i64* %5
%25 = sub i64 %23, %24
%26 = getelementptr inbounds i8, i8* %18, i64 %25
store i8 0, i8* %26
%27 = load i8*, i8** %4
%28 = load i64, i64* %5
%29 = call i32 @print_func(i8* %27, i32 -1, i8* %18, i64 %28)
%30 = load i8*, i8** %7
br label %31
31: ; preds = %12, %3
ret void
}

LLVM IR (-O2):
define void @fill_gap_pos(i8* %0, i64 %1, i64 %2) {
%4 = icmp ugt i64 %2, %1
br i1 %4, label %5, label %13
5: ; preds = %3
%6 = sub i64 %2, %1
%7 = add i64 %6, 1
%8 = tail call i8* @llvm.stacksave()
%9 = alloca i8, i64 %7
%10 = call i32 @memset(i8* %9, i8 signext 32, i64 %6)
%11 = getelementptr inbounds i8, i8* %9, i64 %6
store i8 0, i8* %11
%12 = call i32 @print_func(i8* %0, i32 -1, i8* %9, i64 %1)
br label %13
13: ; preds = %5, %3
ret void
}