#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*/ assert(char const *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void printSpaces(unsigned long num, const char *str) {
  assert(str);
  for (; num > 0; num--) {
    int whitespace = (str[num - 1] == '\t') ? '\t' : ' ';
    fputc(whitespace, stderr);
  }
}


x86 assembly (clang, -O0):
<printSpaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <assert@plt>
cmpq   $0x0,-0x8(%rbp)
jbe    1189 <printSpaces+0x69>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%edx
mov    $0x20,%eax
mov    $0x9,%ecx
cmp    $0x9,%edx
cmove  %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2e6f(%rip),%rax
mov    (%rax),%esi
call   1030 <fputc@plt>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
jmp    1139 <printSpaces+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSpaces>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <assert@plt>
test   %rbx,%rbx
je     116d <printSpaces+0x4d>
mov    $0x9,%r15d
mov    0x2e99(%rip),%rbp
nopw   0x0(%rax,%rax,1)
cmpb   $0x9,-0x1(%r14,%rbx,1)
mov    $0x20,%edi
cmove  %r15d,%edi
mov    0x0(%rbp),%esi
call   1030 <fputc@plt>
add    $0xffffffffffffffff,%rbx
jne    1150 <printSpaces+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
define void @printSpaces(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i32
store i64 %0, i64* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @assert(i8* %6)
br label %8
8: ; preds = %24, %2
%9 = load i64, i64* %3
%10 = icmp ugt i64 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i8*, i8** %4
%13 = load i64, i64* %3
%14 = sub i64 %13, 1
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 9
%19 = zext i1 %18 to i64
%20 = select i1 %18, i32 9, i32 32
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = load i32, i32* @stderr
%23 = call i32 @fputc(i32 %21, i32 %22)
br label %24
24: ; preds = %11
%25 = load i64, i64* %3
%26 = add i64 %25, -1
store i64 %26, i64* %3
br label %8
27: ; preds = %8
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @printSpaces(i64 %0, i8* %1) {
%3 = tail call i32 @assert(i8* %1)
%4 = icmp eq i64 %0, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %7, %5 ], [ %0, %2 ]
%7 = add i64 %6, -1
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 9
%11 = select i1 %10, i32 9, i32 32
%12 = load i32, i32* @stderr
%13 = tail call i32 @fputc(i32 %11, i32 %12)
%14 = icmp eq i64 %7, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
ret void
}