#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*/ is_multipart_boundary(char const);
int is_valid_multipart_boundary_string(const char *s) {
  if (s[0] == '\0')
    return 0;
  for (; *s; ++s)
    if (!is_multipart_boundary(*s))
      return 0;
  return s[-1] != ' ';
}


x86 assembly (clang, -O0):
<is_valid_multipart_boundary_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1138 <is_valid_multipart_boundary_string+0x28>
movl   $0x0,-0x4(%rbp)
jmp    1197 <is_valid_multipart_boundary_string+0x87>
jmp    113d <is_valid_multipart_boundary_string+0x2d>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1181 <is_valid_multipart_boundary_string+0x71>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_multipart_boundary@plt>
cmp    $0x0,%eax
jne    116b <is_valid_multipart_boundary_string+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    1197 <is_valid_multipart_boundary_string+0x87>
jmp    1170 <is_valid_multipart_boundary_string+0x60>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113d <is_valid_multipart_boundary_string+0x2d>
mov    -0x10(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x20,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_multipart_boundary_string>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
xor    %ebp,%ebp
test   %al,%al
je     1151 <is_valid_multipart_boundary_string+0x41>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <is_multipart_boundary@plt>
test   %eax,%eax
je     1151 <is_valid_multipart_boundary_string+0x41>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <is_valid_multipart_boundary_string+0x20>
xor    %ebp,%ebp
cmpb   $0x20,-0x2(%rbx)
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @is_valid_multipart_boundary_string(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %9
%5 = phi i8* [ %10, %9 ], [ %0, %1 ]
%6 = phi i8 [ %11, %9 ], [ %2, %1 ]
%7 = tail call i32 @is_multipart_boundary(i8 signext %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %9
%14 = load i8, i8* %5
%15 = icmp ne i8 %14, 32
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %4, %1, %13
%18 = phi i32 [ %16, %13 ], [ 0, %1 ], [ 0, %4 ]
ret i32 %18
}