#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int tab_to(FILE *out, int from, int to) {
  int tab_width = 8;
  int to_mod = (to / tab_width) * tab_width;
  while (from < to_mod) {
    fprintf(out, "\t");
    from = (((from / tab_width) + 1) * tab_width);
  }
  while (from < to) {
    fprintf(out, " ");
    from++;
  }
  return from;
}


x86 assembly (clang, -O0):
<tab_to>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x8,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
imul   -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1169 <tab_to+0x59>
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x14(%rbp)
add    $0x1,%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <tab_to+0x27>
jmp    116e <tab_to+0x5e>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1198 <tab_to+0x88>
mov    -0x8(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116e <tab_to+0x5e>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tab_to>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r15
lea    0x7(%r14),%ebp
test   %edx,%edx
cmovns %edx,%ebp
and    $0xfffffff8,%ebp
cmp    %esi,%ebp
jle    1158 <tab_to+0x48>
nop
mov    $0x9,%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
lea    0x7(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xfffffff8,%eax
add    $0x8,%eax
mov    %eax,%ebx
cmp    %ebp,%eax
jl     1130 <tab_to+0x20>
cmp    %r14d,%eax
jl     115f <tab_to+0x4f>
jmp    1185 <tab_to+0x75>
mov    %ebx,%eax
cmp    %r14d,%eax
jge    1185 <tab_to+0x75>
mov    %r14d,%ebx
sub    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x20,%edi
mov    %r15,%rsi
call   1030 <fputc@plt>
add    $0xffffffff,%ebx
jne    1170 <tab_to+0x60>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\09\00"
@.str.1 = [2 x i8] c" \00"
define i32 @tab_to(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 8, i32* %7
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = sdiv i32 %9, %10
%12 = load i32, i32* %7
%13 = mul nsw i32 %11, %12
store i32 %13, i32* %8
br label %14
14: ; preds = %18, %3
%15 = load i32, i32* %5
%16 = load i32, i32* %8
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load i32*, i32** %4
%20 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* %5
%22 = load i32, i32* %7
%23 = sdiv i32 %21, %22
%24 = add nsw i32 %23, 1
%25 = load i32, i32* %7
%26 = mul nsw i32 %24, %25
store i32 %26, i32* %5
br label %14
27: ; preds = %14
br label %28
28: ; preds = %32, %27
%29 = load i32, i32* %5
%30 = load i32, i32* %6
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %37
32: ; preds = %28
%33 = load i32*, i32** %4
%34 = call i32 @fprintf(i32* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %28
37: ; preds = %28
%38 = load i32, i32* %5
ret i32 %38
}

LLVM IR (-O2):
define i32 @tab_to(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sdiv i32 %2, 8
%5 = shl nsw i32 %4, 3
%6 = icmp sgt i32 %5, %1
br i1 %6, label %10, label %7
7: ; preds = %10, %3
%8 = phi i32 [ %1, %3 ], [ %15, %10 ]
%9 = icmp slt i32 %8, %2
br i1 %9, label %17, label %22
10: ; preds = %3, %10
%11 = phi i32 [ %15, %10 ], [ %1, %3 ]
%12 = tail call i32 @fputc(i32 9, i32* %0)
%13 = sdiv i32 %11, 8
%14 = shl nsw i32 %13, 3
%15 = add i32 %14, 8
%16 = icmp slt i32 %15, %5
br i1 %16, label %10, label %7
17: ; preds = %7, %17
%18 = phi i32 [ %20, %17 ], [ %8, %7 ]
%19 = tail call i32 @fputc(i32 32, i32* %0)
%20 = add i32 %18, 1
%21 = icmp eq i32 %20, %2
br i1 %21, label %22, label %17
22: ; preds = %17, %7
%23 = phi i32 [ %8, %7 ], [ %2, %17 ]
ret i32 %23
}