#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, char tab_stop) {
  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(tab_stop);
    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(tab_stop);
      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    %cl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1172 <print_blank_with_tab+0x52>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    116d <print_blank_with_tab+0x4d>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1149 <print_blank_with_tab+0x29>
jmp    11fc <print_blank_with_tab+0xdc>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x8,%esi
call   1040 <get_blank_length@plt>
mov    %eax,-0x20(%rbp)
movsbl -0xd(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11c3 <print_blank_with_tab+0xa3>
movsbl -0xd(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x1c(%rbp)
jmp    119d <print_blank_with_tab+0x7d>
mov    -0x4(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f7 <print_blank_with_tab+0xd7>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11d3 <print_blank_with_tab+0xb3>
jmp    11fc <print_blank_with_tab+0xdc>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_blank_with_tab>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
cmp    %edx,%esi
jge    1151 <print_blank_with_tab+0x31>
test   %ebp,%ebp
jle    11bf <print_blank_with_tab+0x9f>
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1140 <print_blank_with_tab+0x20>
jmp    11bf <print_blank_with_tab+0x9f>
mov    %ecx,%r15d
mov    %edx,%r14d
mov    %edi,%ebx
mov    %edi,%r12d
sub    %ebp,%r12d
mov    %r12d,%edi
mov    $0x8,%esi
call   1040 <get_blank_length@plt>
mov    %eax,%r13d
movsbl %r15b,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
add    %r12d,%r13d
sub    %r13d,%ebx
cmp    %r14d,%ebx
jl     119f <print_blank_with_tab+0x7f>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xfffffff8,%ebx
cmp    %r14d,%ebx
jge    1190 <print_blank_with_tab+0x70>
test   %ebx,%ebx
jle    11bf <print_blank_with_tab+0x9f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11b0 <print_blank_with_tab+0x90>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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