#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*/ fatalx(char *);
int /*<<< orphan*/ isspace(char);
char *fnwhite(char *ss) {
  char *x;
  if (ss == NULL)
    fatalx("fnwhite: logic bug\n");
  for (x = ss; *x != '\0'; ++x) {
    if (!isspace(*x))
      return x;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<fnwhite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <fnwhite+0x23>
lea    0xec2(%rip),%rdi
call   1030 <fatalx@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1193 <fnwhite+0x73>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    117d <fnwhite+0x5d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    119b <fnwhite+0x7b>
jmp    1182 <fnwhite+0x62>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114b <fnwhite+0x2b>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnwhite>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    1135 <fnwhite+0x15>
lea    0xed0(%rip),%rdi
call   1030 <fatalx@plt>
mov    (%rbx),%al
test   %al,%al
je     1158 <fnwhite+0x38>
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1040 <isspace@plt>
test   %eax,%eax
je     115a <fnwhite+0x3a>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <fnwhite+0x20>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"fnwhite: logic bug\0A\00"
define i8* @fnwhite(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @fatalx(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
store i8* %10, i8** %4
br label %11
11: ; preds = %24, %9
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %27
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = call i32 @isspace(i8 signext %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %16
%22 = load i8*, i8** %4
store i8* %22, i8** %2
br label %28
23: ; preds = %16
br label %24
24: ; preds = %23
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %4
br label %11
27: ; preds = %11
store i8* null, i8** %2
br label %28
28: ; preds = %27, %21
%29 = load i8*, i8** %2
ret i8* %29
}

LLVM IR (-O2):
@.str = [20 x i8] c"fnwhite: logic bug\0A\00"
define i8* @fnwhite(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @fatalx(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %5, %13
%9 = phi i8 [ %15, %13 ], [ %6, %5 ]
%10 = phi i8* [ %14, %13 ], [ %0, %5 ]
%11 = tail call i32 @isspace(i8 signext %9)
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %8
17: ; preds = %8, %13, %5
%18 = phi i8* [ null, %5 ], [ null, %13 ], [ %10, %8 ]
ret i8* %18
}