#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(char);
int strlen(char *);
short cleanConfigLine(char *opt) {
  short ret_val = 1;
  int i = 0;
  while (isspace(*opt)) {
    opt++;
  }
  for (i = strlen(opt) - 1; i >= 0 && isspace(opt[i]); --i) {
    opt[i] = '\0';
  }
  if (opt[0] != '\0' && opt[0] != ';') {
    ret_val = (!1);
  }
  return ret_val;
}


x86 assembly (clang, -O0):
<cleanConfigLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movw   $0x1,-0xa(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1160 <cleanConfigLine+0x40>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1139 <cleanConfigLine+0x19>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jl     1199 <cleanConfigLine+0x79>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11a9 <cleanConfigLine+0x89>
jmp    11c3 <cleanConfigLine+0xa3>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    116f <cleanConfigLine+0x4f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11e9 <cleanConfigLine+0xc9>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
je     11e9 <cleanConfigLine+0xc9>
movw   $0x0,-0xa(%rbp)
movswl -0xa(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanConfigLine>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isspace@plt>
test   %rax,%rax
jne    1130 <cleanConfigLine+0x10>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    1185 <cleanConfigLine+0x65>
mov    %eax,%r14d
add    $0x1,%r14
add    $0xffffffff,%eax
nopl   0x0(%rax,%rax,1)
mov    %eax,%r15d
movsbl (%rbx,%r15,1),%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1185 <cleanConfigLine+0x65>
movb   $0x0,(%rbx,%r15,1)
add    $0xffffffffffffffff,%r14
lea    -0x1(%r15),%eax
cmp    $0x1,%r14
ja     1160 <cleanConfigLine+0x40>
mov    (%rbx),%al
test   %al,%al
sete   %cl
cmp    $0x3b,%al
sete   %al
or     %cl,%al
movzbl %al,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define signext i16 @cleanConfigLine(i8* %0) {
%2 = alloca i8*
%3 = alloca i16
%4 = alloca i32
store i8* %0, i8** %2
store i16 1, i16* %3
store i32 0, i32* %4
br label %5
5: ; preds = %10, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = call i64 @isspace(i8 signext %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
br label %5
13: ; preds = %5
%14 = load i8*, i8** %2
%15 = call i32 @strlen(i8* %14)
%16 = sub nsw i32 %15, 1
store i32 %16, i32* %4
br label %17
17: ; preds = %35, %13
%18 = load i32, i32* %4
%19 = icmp sge i32 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = load i8*, i8** %2
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = call i64 @isspace(i8 signext %25)
%27 = icmp ne i64 %26, 0
br label %28
28: ; preds = %20, %17
%29 = phi i1 [ false, %17 ], [ %27, %20 ]
br i1 %29, label %30, label %38
30: ; preds = %28
%31 = load i8*, i8** %2
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
store i8 0, i8* %34
br label %35
35: ; preds = %30
%36 = load i32, i32* %4
%37 = add nsw i32 %36, -1
store i32 %37, i32* %4
br label %17
38: ; preds = %28
%39 = load i8*, i8** %2
%40 = getelementptr inbounds i8, i8* %39, i64 0
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %51
44: ; preds = %38
%45 = load i8*, i8** %2
%46 = getelementptr inbounds i8, i8* %45, i64 0
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 59
br i1 %49, label %50, label %51
50: ; preds = %44
store i16 0, i16* %3
br label %51
51: ; preds = %50, %44, %38
%52 = load i16, i16* %3
ret i16 %52
}

LLVM IR (-O2):
define signext i16 @cleanConfigLine(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = tail call i32 @strlen(i8* %3)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %8
%12 = zext i32 %9 to i64
br label %13
13: ; preds = %11, %21
%14 = phi i64 [ %12, %11 ], [ %15, %21 ]
%15 = add nsw i64 %14, -1
%16 = and i64 %15, 4294967295
%17 = getelementptr inbounds i8, i8* %3, i64 %16
%18 = load i8, i8* %17
%19 = tail call i64 @isspace(i8 signext %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %13
store i8 0, i8* %17
%22 = icmp ugt i64 %14, 1
br i1 %22, label %13, label %23
23: ; preds = %13, %21, %8
%24 = load i8, i8* %3
%25 = icmp eq i8 %24, 0
%26 = icmp eq i8 %24, 59
%27 = or i1 %25, %26
%28 = zext i1 %27 to i16
ret i16 %28
}