#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 */
scalar_t__ g(char);
f(char *p) {
  char c;
  c = *++p;
  if (c != ' ')
    return 0;
  for (; 1;) {
    c = *p;
    if (g(c))
      p++;
    else {
      if (c == ' ')
        break;
      else
        return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x1(%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
je     114a <f+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    11b5 <f+0xa5>
jmp    114f <f+0x3f>
mov    $0x1,%al
test   $0x1,%al
jne    115e <f+0x4e>
jmp    11ae <f+0x9e>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1030 <g@plt>
cmp    $0x0,%rax
je     118b <f+0x7b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11a9 <f+0x99>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    119d <f+0x8d>
jmp    11ae <f+0x9e>
movl   $0x0,-0x4(%rbp)
jmp    11b5 <f+0xa5>
jmp    114f <f+0x3f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
cmpb   $0x20,0x1(%rdi)
jne    1165 <f+0x55>
mov    %rdi,%rbx
mov    $0x20,%edi
call   1030 <g@plt>
test   %rax,%rax
je     1160 <f+0x50>
add    $0x2,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rbx),%ebp
movsbl %bpl,%edi
call   1030 <g@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1140 <f+0x30>
xor    %eax,%eax
cmp    $0x20,%bpl
sete   %al
jmp    1165 <f+0x55>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @f(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 32
br i1 %4, label %5, label %19
5: ; preds = %1
%6 = tail call i64 @g(i8 signext 32)
%7 = icmp eq i64 %6, 0
br i1 %7, label %19, label %8
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %0, i64 2
br label %10
10: ; preds = %8, %10
%11 = phi i8* [ %9, %8 ], [ %15, %10 ]
%12 = load i8, i8* %11
%13 = tail call i64 @g(i8 signext %12)
%14 = icmp eq i64 %13, 0
%15 = getelementptr inbounds i8, i8* %11, i64 1
br i1 %14, label %16, label %10
16: ; preds = %10
%17 = icmp eq i8 %12, 32
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %5, %16, %1
%20 = phi i32 [ 0, %1 ], [ %18, %16 ], [ 1, %5 ]
ret i32 %20
}