#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__ _ini_isws(char);
int /*<<< orphan*/ memmove(char *, char *, size_t);
size_t strlen(char *);
void _ini_striml(char *s) {
  int index = 0;
  while (_ini_isws(s[index])) {
    ++index;
  }
  size_t len = strlen(s);
  memmove(s, &s[index], len - index);
  s[len - index] = 0x0;
}


x86 assembly (clang, -O0):
<_ini_striml>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <_ini_isws@plt>
cmp    $0x0,%rax
je     116c <_ini_striml+0x3c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <_ini_striml+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
movslq -0xc(%rbp),%rax
sub    %rax,%rdx
call   1040 <memmove@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0xc(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ini_striml>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
mov    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl 0x1(%r12,%rbx,1),%edi
call   1050 <_ini_isws@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1150 <_ini_striml+0x20>
mov    %ebx,%ebx
lea    (%r12,%rbx,1),%r14
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
sub    %rbx,%r15
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memmove@plt>
movb   $0x0,(%r12,%r15,1)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @_ini_striml(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %8, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = tail call i64 @_ini_isws(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = add nuw i64 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
%10 = and i64 %3, 4294967295
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%13 = sub i64 %12, %10
%14 = tail call i32 @memmove(i8* %0, i8* %11, i64 %13)
%15 = getelementptr inbounds i8, i8* %0, i64 %13
store i8 0, i8* %15
ret void
}