#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 get_blank_length(int, int);
int /*<<< orphan*/ putchar(char);
void print_blank_with_tab(int cur_line_length, int cur_blanks_length,
                          int blank_num_per_tab) {
  int remain_blank;
  int blank_index;
  int last_non_blank_length;
  int first_tab_equal_blank;
  if (cur_blanks_length < blank_num_per_tab) {
    for (blank_index = 0; blank_index < cur_blanks_length; blank_index++) {
      putchar(' ');
    }
  } else {
    last_non_blank_length = cur_line_length - cur_blanks_length;
    first_tab_equal_blank = get_blank_length(last_non_blank_length, 8);
    putchar('\t');
    last_non_blank_length = last_non_blank_length + first_tab_equal_blank;
    while (cur_line_length - last_non_blank_length >= blank_num_per_tab) {
      putchar('\t');
      last_non_blank_length += 8;
    }
    remain_blank = cur_line_length - last_non_blank_length;
    for (blank_index = 0; blank_index < remain_blank; blank_index++) {
      putchar(' ');
    }
  }
}


x86 assembly (clang, -O0):
<print_blank_with_tab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116d <print_blank_with_tab+0x4d>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1168 <print_blank_with_tab+0x48>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <print_blank_with_tab+0x24>
jmp    11f9 <print_blank_with_tab+0xd9>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    $0x8,%esi
call   1040 <get_blank_length@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x9,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11c0 <print_blank_with_tab+0xa0>
mov    $0x9,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x18(%rbp)
jmp    1199 <print_blank_with_tab+0x79>
mov    -0x4(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f4 <print_blank_with_tab+0xd4>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d0 <print_blank_with_tab+0xb0>
jmp    11f9 <print_blank_with_tab+0xd9>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_blank_with_tab>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
cmp    %edx,%esi
jge    1151 <print_blank_with_tab+0x31>
test   %ebp,%ebp
jle    11af <print_blank_with_tab+0x8f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1140 <print_blank_with_tab+0x20>
jmp    11af <print_blank_with_tab+0x8f>
mov    %edx,%r14d
mov    %edi,%ebx
mov    %edi,%r15d
sub    %ebp,%r15d
mov    %r15d,%edi
mov    $0x8,%esi
call   1040 <get_blank_length@plt>
mov    %eax,%ebp
mov    $0x9,%edi
call   1030 <putchar@plt>
add    %r15d,%ebp
sub    %ebp,%ebx
cmp    %r14d,%ebx
jl     1192 <print_blank_with_tab+0x72>
nop
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0xfffffff8,%ebx
cmp    %r14d,%ebx
jge    1180 <print_blank_with_tab+0x60>
test   %ebx,%ebx
jle    11af <print_blank_with_tab+0x8f>
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11a0 <print_blank_with_tab+0x80>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @print_blank_with_tab(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %25
14: ; preds = %3
store i32 0, i32* %8
br label %15
15: ; preds = %21, %14
%16 = load i32, i32* %8
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = call i32 @putchar(i8 signext 32)
br label %21
21: ; preds = %19
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
store i32 %23, i32* %8
br label %15
24: ; preds = %15
br label %59
25: ; preds = %3
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = sub nsw i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %9
%30 = call i32 @get_blank_length(i32 %29, i32 8)
store i32 %30, i32* %10
%31 = call i32 @putchar(i8 signext 9)
%32 = load i32, i32* %9
%33 = load i32, i32* %10
%34 = add nsw i32 %32, %33
store i32 %34, i32* %9
br label %35
35: ; preds = %41, %25
%36 = load i32, i32* %4
%37 = load i32, i32* %9
%38 = sub nsw i32 %36, %37
%39 = load i32, i32* %6
%40 = icmp sge i32 %38, %39
br i1 %40, label %41, label %45
41: ; preds = %35
%42 = call i32 @putchar(i8 signext 9)
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 8
store i32 %44, i32* %9
br label %35
45: ; preds = %35
%46 = load i32, i32* %4
%47 = load i32, i32* %9
%48 = sub nsw i32 %46, %47
store i32 %48, i32* %7
store i32 0, i32* %8
br label %49
49: ; preds = %55, %45
%50 = load i32, i32* %8
%51 = load i32, i32* %7
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %58
53: ; preds = %49
%54 = call i32 @putchar(i8 signext 32)
br label %55
55: ; preds = %53
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
br label %49
58: ; preds = %49
br label %59
59: ; preds = %58, %24
ret void
}

LLVM IR (-O2):
define void @print_blank_with_tab(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %12
5: ; preds = %3
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %33
7: ; preds = %5, %7
%8 = phi i32 [ %10, %7 ], [ 0, %5 ]
%9 = tail call i32 @putchar(i8 signext 32)
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %33, label %7
12: ; preds = %3
%13 = sub nsw i32 %0, %1
%14 = tail call i32 @get_blank_length(i32 %13, i32 8)
%15 = tail call i32 @putchar(i8 signext 9)
%16 = add nsw i32 %14, %13
%17 = sub nsw i32 %0, %16
%18 = icmp slt i32 %17, %2
br i1 %18, label %19, label %22
19: ; preds = %22, %12
%20 = phi i32 [ %17, %12 ], [ %26, %22 ]
%21 = icmp sgt i32 %20, 0
br i1 %21, label %28, label %33
22: ; preds = %12, %22
%23 = phi i32 [ %25, %22 ], [ %16, %12 ]
%24 = tail call i32 @putchar(i8 signext 9)
%25 = add nsw i32 %23, 8
%26 = sub nsw i32 %0, %25
%27 = icmp slt i32 %26, %2
br i1 %27, label %19, label %22
28: ; preds = %19, %28
%29 = phi i32 [ %31, %28 ], [ 0, %19 ]
%30 = tail call i32 @putchar(i8 signext 32)
%31 = add nuw nsw i32 %29, 1
%32 = icmp eq i32 %31, %20
br i1 %32, label %33, label %28
33: ; preds = %28, %7, %19, %5
ret void
}