#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*/ assert(char *);
scalar_t__ isspace(char);
int /*<<< orphan*/ memmove(char *, char *, int);
int strlen(char *);
void str_left_adjust(char *str) {
  register char *nb;
  assert(str);
  nb = str;
  while (*nb && isspace(*nb))
    nb++;
  memmove(str, nb, strlen(str) - (str - nb) + 1);
}


x86 assembly (clang, -O0):
<str_left_adjust>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1188 <str_left_adjust+0x48>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1198 <str_left_adjust+0x58>
jmp    11a9 <str_left_adjust+0x69>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    115d <str_left_adjust+0x1d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
cltq
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edx
call   1060 <memmove@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_left_adjust>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <assert@plt>
mov    (%r14),%al
mov    %r14,%rbx
test   %al,%al
je     1179 <str_left_adjust+0x39>
mov    %r14,%rbx
nopl   0x0(%rax)
movsbl %al,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1179 <str_left_adjust+0x39>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1160 <str_left_adjust+0x20>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %ebx,%ecx
sub    %r14d,%ecx
lea    (%rcx,%rax,1),%edx
add    $0x1,%edx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <memmove@plt>

LLVM IR (-O0):
define void @str_left_adjust(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @assert(i8* %4)
%6 = load i8*, i8** %2
store i8* %6, i8** %3
br label %7
7: ; preds = %19, %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = call i64 @isspace(i8 signext %14)
%16 = icmp ne i64 %15, 0
br label %17
17: ; preds = %12, %7
%18 = phi i1 [ false, %7 ], [ %16, %12 ]
br i1 %18, label %19, label %22
19: ; preds = %17
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
br label %7
22: ; preds = %17
%23 = load i8*, i8** %2
%24 = load i8*, i8** %3
%25 = load i8*, i8** %2
%26 = call i32 @strlen(i8* %25)
%27 = sext i32 %26 to i64
%28 = load i8*, i8** %2
%29 = load i8*, i8** %3
%30 = ptrtoint i8* %28 to i64
%31 = ptrtoint i8* %29 to i64
%32 = sub i64 %30, %31
%33 = sub nsw i64 %27, %32
%34 = add nsw i64 %33, 1
%35 = trunc i64 %34 to i32
%36 = call i32 @memmove(i8* %23, i8* %24, i32 %35)
ret void
}

LLVM IR (-O2):
define void @str_left_adjust(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %1, %10
%6 = phi i8 [ %12, %10 ], [ %3, %1 ]
%7 = phi i8* [ %11, %10 ], [ %0, %1 ]
%8 = tail call i64 @isspace(i8 signext %6)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %1
%15 = phi i8* [ %0, %1 ], [ %11, %10 ], [ %7, %5 ]
%16 = tail call i32 @strlen(i8* %0)
%17 = ptrtoint i8* %0 to i64
%18 = ptrtoint i8* %15 to i64
%19 = sub i64 %18, %17
%20 = trunc i64 %19 to i32
%21 = add i32 %20, 1
%22 = add i32 %21, %16
%23 = tail call i32 @memmove(i8* %0, i8* %15, i32 %22)
ret void
}