#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*/ xmlc_white_space(int /*<<< orphan*/);
int whitespace(char *text, int n_txt) {
  char *s = text, *end = text + n_txt;
  for (;;) {
    if (s == end)
      return 1;
    if (!xmlc_white_space(*(s++)))
      return 0;
  }
}


x86 assembly (clang, -O0):
<whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    1150 <whitespace+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1181 <whitespace+0x71>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl (%rax),%edi
call   1030 <xmlc_white_space@plt>
cmp    $0x0,%eax
jne    117c <whitespace+0x6c>
movl   $0x0,-0x4(%rbp)
jmp    1181 <whitespace+0x71>
jmp    1136 <whitespace+0x26>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whitespace>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
movslq %esi,%r15
xor    %ebx,%ebx
nopl   (%rax)
cmp    %rbx,%r15
je     113b <whitespace+0x2b>
movsbl (%r14,%rbx,1),%edi
call   1030 <xmlc_white_space@plt>
add    $0x1,%rbx
test   %eax,%eax
jne    1120 <whitespace+0x10>
xor    %eax,%eax
jmp    1140 <whitespace+0x30>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @whitespace(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
store i8* %12, i8** %7
br label %13
13: ; preds = %26, %2
%14 = load i8*, i8** %6
%15 = load i8*, i8** %7
%16 = icmp eq i8* %14, %15
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 1, i32* %3
br label %27
18: ; preds = %13
%19 = load i8*, i8** %6
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %6
%21 = load i8, i8* %19
%22 = sext i8 %21 to i32
%23 = call i32 @xmlc_white_space(i32 %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %18
store i32 0, i32* %3
br label %27
26: ; preds = %18
br label %13
27: ; preds = %25, %17
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @whitespace(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
br label %5
5: ; preds = %8, %2
%6 = phi i8* [ %0, %2 ], [ %9, %8 ]
%7 = icmp eq i8* %6, %4
br i1 %7, label %14, label %8
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %6
%11 = sext i8 %10 to i32
%12 = tail call i32 @xmlc_white_space(i32 %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %8, %5
%15 = phi i32 [ 1, %5 ], [ 0, %8 ]
ret i32 %15
}