#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*/ EXIT_FAILURE;
int /*<<< orphan*/ errx(int /*<<< orphan*/, char *);
scalar_t__ isspace(char const);
const char *skip_leading_spaces(const char *s) {
  for (; isspace(*s); s++)
    if (*s == '\0')
      errx(EXIT_FAILURE, "empty argument");
  return s;
}


x86 assembly (clang, -O0):
<skip_leading_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     117d <skip_leading_spaces+0x5d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1167 <skip_leading_spaces+0x47>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
call   1030 <errx@plt>
jmp    116c <skip_leading_spaces+0x4c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112c <skip_leading_spaces+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_leading_spaces>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1174 <skip_leading_spaces+0x54>
mov    0x2ea4(%rip),%r15
lea    0xebd(%rip),%r14
jmp    1162 <skip_leading_spaces+0x42>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isspace@plt>
test   %rax,%rax
je     1174 <skip_leading_spaces+0x54>
cmpb   $0x0,(%rbx)
jne    1150 <skip_leading_spaces+0x30>
mov    (%r15),%edi
mov    %r14,%rsi
call   1030 <errx@plt>
jmp    1150 <skip_leading_spaces+0x30>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [15 x i8] c"empty argument\00"
define i8* @skip_leading_spaces(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %17, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = call i64 @isspace(i8 signext %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @errx(i32 %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %13, %8
br label %17
17: ; preds = %16
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %2
br label %3
20: ; preds = %3
%21 = load i8*, i8** %2
ret i8* %21
}

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