#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*/ putstr(char **, size_t *, char *);
bool whitespace(char **out, size_t *outlen, size_t x, size_t y, size_t *posx,
                size_t *posy) {
  while (y > *posy) {
    if (!putstr(out, outlen, "\n"))
      return false;
    *posx = 0;
    ++*posy;
  }
  while (x > *posx) {
    if (!putstr(out, outlen, " "))
      return false;
    ++*posx;
  }
  return true;
}


x86 assembly (clang, -O0):
<whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%rcx
cmp    (%rcx),%rax
jbe    1188 <whitespace+0x78>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    0xeb0(%rip),%rdx
call   1030 <putstr@plt>
cmp    $0x0,%eax
jne    116a <whitespace+0x5a>
movl   $0x0,-0x4(%rbp)
jmp    11e1 <whitespace+0xd1>
mov    -0x30(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x38(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1130 <whitespace+0x20>
jmp    118d <whitespace+0x7d>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
cmp    (%rcx),%rax
jbe    11da <whitespace+0xca>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    0xe55(%rip),%rdx
call   1030 <putstr@plt>
cmp    $0x0,%eax
jne    11c7 <whitespace+0xb7>
movl   $0x0,-0x4(%rbp)
jmp    11e1 <whitespace+0xd1>
mov    -0x30(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    118d <whitespace+0x7d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whitespace>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
cmp    %rcx,(%r9)
jae    116e <whitespace+0x5e>
mov    %r9,%rbp
mov    %rcx,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r15,%rsi
lea    0xeb3(%rip),%rdx
call   1030 <putstr@plt>
test   %eax,%eax
je     11a3 <whitespace+0x93>
movq   $0x0,(%rbx)
mov    0x0(%rbp),%rax
add    $0x1,%rax
mov    %rax,0x0(%rbp)
cmp    %r13,%rax
jb     1140 <whitespace+0x30>
mov    $0x1,%r13d
cmp    %r14,(%rbx)
jae    11a6 <whitespace+0x96>
lea    0xe82(%rip),%rbp
mov    %r12,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1030 <putstr@plt>
test   %eax,%eax
je     11a3 <whitespace+0x93>
mov    (%rbx),%rax
add    $0x1,%rax
mov    %rax,(%rbx)
cmp    %r14,%rax
jb     1180 <whitespace+0x70>
jmp    11a6 <whitespace+0x96>
xor    %r13d,%r13d
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [2 x i8] c" \00"
define i32 @whitespace(i8** %0, i64* %1, i64 %2, i64 %3, i64* %4, i64* %5) {
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i64*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64*
%13 = alloca i64*
store i8** %0, i8*** %8
store i64* %1, i64** %9
store i64 %2, i64* %10
store i64 %3, i64* %11
store i64* %4, i64** %12
store i64* %5, i64** %13
br label %14
14: ; preds = %25, %6
%15 = load i64, i64* %11
%16 = load i64*, i64** %13
%17 = load i64, i64* %16
%18 = icmp ugt i64 %15, %17
br i1 %18, label %19, label %30
19: ; preds = %14
%20 = load i8**, i8*** %8
%21 = load i64*, i64** %9
%22 = call i32 @putstr(i8** %20, i64* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %19
store i32 0, i32* %7
br label %47
25: ; preds = %19
%26 = load i64*, i64** %12
store i64 0, i64* %26
%27 = load i64*, i64** %13
%28 = load i64, i64* %27
%29 = add i64 %28, 1
store i64 %29, i64* %27
br label %14
30: ; preds = %14
br label %31
31: ; preds = %42, %30
%32 = load i64, i64* %10
%33 = load i64*, i64** %12
%34 = load i64, i64* %33
%35 = icmp ugt i64 %32, %34
br i1 %35, label %36, label %46
36: ; preds = %31
%37 = load i8**, i8*** %8
%38 = load i64*, i64** %9
%39 = call i32 @putstr(i8** %37, i64* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %42, label %41
41: ; preds = %36
store i32 0, i32* %7
br label %47
42: ; preds = %36
%43 = load i64*, i64** %12
%44 = load i64, i64* %43
%45 = add i64 %44, 1
store i64 %45, i64* %43
br label %31
46: ; preds = %31
store i32 1, i32* %7
br label %47
47: ; preds = %46, %41, %24
%48 = load i32, i32* %7
ret i32 %48
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [2 x i8] c" \00"
define i32 @whitespace(i8** %0, i64* %1, i64 %2, i64 %3, i64* nocapture %4, i64* nocapture %5) {
%7 = load i64, i64* %5
%8 = icmp ult i64 %7, %3
br i1 %8, label %12, label %9
9: ; preds = %15, %6
%10 = load i64, i64* %4
%11 = icmp ult i64 %10, %2
br i1 %11, label %19, label %26
12: ; preds = %6, %15
%13 = tail call i32 @putstr(i8** %0, i64* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %26, label %15
15: ; preds = %12
store i64 0, i64* %4
%16 = load i64, i64* %5
%17 = add i64 %16, 1
store i64 %17, i64* %5
%18 = icmp ult i64 %17, %3
br i1 %18, label %12, label %9
19: ; preds = %9, %22
%20 = tail call i32 @putstr(i8** %0, i64* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = load i64, i64* %4
%24 = add i64 %23, 1
store i64 %24, i64* %4
%25 = icmp ult i64 %24, %2
br i1 %25, label %19, label %26
26: ; preds = %12, %19, %22, %9
%27 = phi i32 [ 1, %9 ], [ 0, %19 ], [ 1, %22 ], [ 0, %12 ]
ret i32 %27
}