#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 */
struct strbuf {
  int dummy;
};
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int /*<<< orphan*/ strbuf_write(struct strbuf *, char const *, int);
void print_spaces(struct strbuf *buf, int count) {
  static const char s[] = "                    ";
  while (count >= sizeof(s)) {
    strbuf_write(buf, s, sizeof(s) - 1);
    count -= sizeof(s) - 1;
  }
  strbuf_write(buf, s, count);
}


x86 assembly (clang, -O0):
<print_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0x15,%rax
jb     1152 <print_spaces+0x42>
mov    -0x8(%rbp),%rdi
lea    0xec8(%rip),%rsi
mov    $0x14,%edx
call   1030 <strbuf_write@plt>
movslq -0xc(%rbp),%rax
sub    $0x14,%rax
mov    %eax,-0xc(%rbp)
jmp    111f <print_spaces+0xf>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xea0(%rip),%rsi
call   1030 <strbuf_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_spaces>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
cmp    $0x15,%esi
jb     1148 <print_spaces+0x38>
lea    0xeda(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x14,%edx
call   1030 <strbuf_write@plt>
add    $0xffffffec,%ebx
cmp    $0x14,%ebx
ja     1130 <print_spaces+0x20>
lea    0xeb1(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <strbuf_write@plt>

LLVM IR (-O0):
%struct.strbuf = type { i32 }
@print_spaces.s = internal constant [21 x i8] c" \00"
define void @print_spaces(%struct.strbuf* %0, i32 %1) {
%3 = alloca %struct.strbuf*
%4 = alloca i32
store %struct.strbuf* %0, %struct.strbuf** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %9, %2
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = icmp uge i64 %7, 21
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = load %struct.strbuf*, %struct.strbuf** %3
%11 = call i32 @strbuf_write(%struct.strbuf* %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @print_spaces.s, i64 0, i64 0), i32 20)
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = sub i64 %13, 20
%15 = trunc i64 %14 to i32
store i32 %15, i32* %4
br label %5
16: ; preds = %5
%17 = load %struct.strbuf*, %struct.strbuf** %3
%18 = load i32, i32* %4
%19 = call i32 @strbuf_write(%struct.strbuf* %17, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @print_spaces.s, i64 0, i64 0), i32 %18)
ret void
}

LLVM IR (-O2):
%struct.strbuf = type { i32 }
@print_spaces.s = internal constant [21 x i8] c" \00"
define void @print_spaces(%struct.strbuf* %0, i32 %1) {
%3 = icmp ugt i32 %1, 20
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = tail call i32 @strbuf_write(%struct.strbuf* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @print_spaces.s, i64 0, i64 0), i32 20)
%7 = add i32 %5, -20
%8 = icmp ugt i32 %7, 20
br i1 %8, label %4, label %9
9: ; preds = %4, %2
%10 = phi i32 [ %1, %2 ], [ %7, %4 ]
%11 = tail call i32 @strbuf_write(%struct.strbuf* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @print_spaces.s, i64 0, i64 0), i32 %10)
ret void
}