#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__ isspace(unsigned char);
const char *skip_white_spaces(const char *str) {
  if (!str) {
    return NULL;
  }
  while (*str && isspace((unsigned char)*str)) {
    str++;
  }
  if (!*str) {
    return NULL;
  }
  return str;
}


x86 assembly (clang, -O0):
<skip_white_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <skip_white_spaces+0x24>
movq   $0x0,-0x8(%rbp)
jmp    11a7 <skip_white_spaces+0x97>
jmp    1139 <skip_white_spaces+0x29>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1164 <skip_white_spaces+0x54>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1174 <skip_white_spaces+0x64>
jmp    1185 <skip_white_spaces+0x75>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1139 <skip_white_spaces+0x29>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    119f <skip_white_spaces+0x8f>
movq   $0x0,-0x8(%rbp)
jmp    11a7 <skip_white_spaces+0x97>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_white_spaces>:
push   %rbx
test   %rdi,%rdi
je     1140 <skip_white_spaces+0x30>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1140 <skip_white_spaces+0x30>
nop
movzbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     113b <skip_white_spaces+0x2b>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <skip_white_spaces+0x10>
jmp    1140 <skip_white_spaces+0x30>
cmpb   $0x0,(%rbx)
jne    1142 <skip_white_spaces+0x32>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

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