#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__ isascii(char);
scalar_t__ iscntrl(char);
scalar_t__ isspace(char);
char *ztrim_left(char *str) {
  char *np;
  for (np = str; *np && (((isascii(*np) && isspace(*np)) || iscntrl(*np)));
       np++)
    ;
  ;
  return np;
}


x86 assembly (clang, -O0):
<ztrim_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
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     11a9 <ztrim_left+0x79>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isascii@plt>
cmp    $0x0,%rax
je     118d <ztrim_left+0x5d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x12(%rbp)
jne    11a3 <ztrim_left+0x73>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <iscntrl@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11b9 <ztrim_left+0x89>
jmp    11cf <ztrim_left+0x9f>
jmp    11be <ztrim_left+0x8e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1144 <ztrim_left+0x14>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ztrim_left>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
jmp    1155 <ztrim_left+0x25>
nopl   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
call   1030 <iscntrl@plt>
test   %rax,%rax
je     1175 <ztrim_left+0x45>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1175 <ztrim_left+0x45>
movsbl %al,%edi
call   1050 <isascii@plt>
test   %rax,%rax
je     1140 <ztrim_left+0x10>
movsbl (%rbx),%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    114d <ztrim_left+0x1d>
jmp    1140 <ztrim_left+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

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