#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*/ putchar(char);
int print_spaces(int column, int tabsize, int *tabstops) {
  if (tabstops) {
    int tabstop = 0;
    while ((tabstop = *tabstops++) != -1) {
      if (column >= tabstop)
        continue;
      else {
        while (column++ < tabstop)
          putchar(' ');
        return column;
      }
    }
  }
  do {
    putchar(' ');
  } while (++column % tabsize != 0);
  return column;
}


x86 assembly (clang, -O0):
<print_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     119a <print_spaces+0x8a>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     1195 <print_spaces+0x85>
mov    -0x8(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     1162 <print_spaces+0x52>
jmp    1134 <print_spaces+0x24>
jmp    1167 <print_spaces+0x57>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
cmp    -0x1c(%rbp),%eax
jge    118a <print_spaces+0x7a>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1167 <print_spaces+0x57>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11c5 <print_spaces+0xb5>
jmp    119a <print_spaces+0x8a>
jmp    119f <print_spaces+0x8f>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    119f <print_spaces+0x8f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_spaces>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
test   %rdx,%rdx
je     1160 <print_spaces+0x50>
xchg   %ax,%ax
mov    (%rdx),%ebp
cmp    $0xffffffff,%ebp
je     1160 <print_spaces+0x50>
add    $0x4,%rdx
cmp    %ebx,%ebp
jle    1120 <print_spaces+0x10>
lea    0x1(%rbx),%r14d
cmp    %r14d,%ebp
cmovg  %ebp,%r14d
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    %ebp,%ebx
jl     1140 <print_spaces+0x30>
add    $0x1,%r14d
mov    %r14d,%ebx
jmp    1177 <print_spaces+0x67>
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
mov    %ebx,%eax
cltd
idiv   %r14d
test   %edx,%edx
jne    1160 <print_spaces+0x50>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @print_spaces(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* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%9 = load i32*, i32** %7
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %33
11: ; preds = %3
store i32 0, i32* %8
br label %12
12: ; preds = %21, %11
%13 = load i32*, i32** %7
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %7
%15 = load i32, i32* %13
store i32 %15, i32* %8
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %32
17: ; preds = %12
%18 = load i32, i32* %5
%19 = load i32, i32* %8
%20 = icmp sge i32 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17
br label %12
22: ; preds = %17
br label %23
23: ; preds = %28, %22
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
%26 = load i32, i32* %8
%27 = icmp slt i32 %24, %26
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = call i32 @putchar(i8 signext 32)
br label %23
30: ; preds = %23
%31 = load i32, i32* %5
store i32 %31, i32* %4
br label %44
32: ; preds = %12
br label %33
33: ; preds = %32, %3
br label %34
34: ; preds = %36, %33
%35 = call i32 @putchar(i8 signext 32)
br label %36
36: ; preds = %34
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
%39 = load i32, i32* %6
%40 = srem i32 %38, %39
%41 = icmp ne i32 %40, 0
br i1 %41, label %34, label %42
42: ; preds = %36
%43 = load i32, i32* %5
store i32 %43, i32* %4
br label %44
44: ; preds = %42, %30
%45 = load i32, i32* %4
ret i32 %45
}

LLVM IR (-O2):
define i32 @print_spaces(i32 %0, i32 %1, i32* %2) {
%4 = icmp eq i32* %2, null
br i1 %4, label %5, label %6
5: ; preds = %6, %3
br label %23
6: ; preds = %3, %10
%7 = phi i32* [ %11, %10 ], [ %2, %3 ]
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, -1
br i1 %9, label %5, label %10
10: ; preds = %6
%11 = getelementptr inbounds i32, i32* %7, i64 1
%12 = icmp sgt i32 %8, %0
br i1 %12, label %13, label %6
13: ; preds = %10
%14 = add nsw i32 %0, 1
%15 = call i32 @llvm.smax.i32(i32 %8, i32 %14)
br label %16
16: ; preds = %13, %16
%17 = phi i32 [ %19, %16 ], [ %14, %13 ]
%18 = tail call i32 @putchar(i8 signext 32)
%19 = add nsw i32 %17, 1
%20 = icmp slt i32 %17, %8
br i1 %20, label %16, label %21
21: ; preds = %16
%22 = add i32 %15, 1
br label %29
23: ; preds = %5, %23
%24 = phi i32 [ %26, %23 ], [ %0, %5 ]
%25 = tail call i32 @putchar(i8 signext 32)
%26 = add nsw i32 %24, 1
%27 = srem i32 %26, %1
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %23
29: ; preds = %23, %21
%30 = phi i32 [ %22, %21 ], [ %26, %23 ]
ret i32 %30
}