#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*/ printf(char *);
int strspn(char *, char *);
int test_strspn(void) {
  printf("\tstrspn");
  if (strspn("aabbcc", "a") != 2)
    return 1;
  if (strspn("aabbcc", "ab") != 4)
    return 1;
  if (strspn("aabbcc", "ba") != 4)
    return 1;
  if (strspn("ababcc", "ba") != 4)
    return 1;
  if (strspn("aabbcc", "abc") != 6)
    return 1;
  if (strspn("aabbcc", "cab") != 6)
    return 1;
  printf("\tpassed.\n");
  return 0;
}


x86 assembly (clang, -O0):
<test_strspn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0xece(%rip),%rsi
call   1040 <strspn@plt>
cmp    $0x2,%eax
je     115c <test_strspn+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1237 <test_strspn+0x117>
lea    0xea5(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1040 <strspn@plt>
cmp    $0x4,%eax
je     1184 <test_strspn+0x64>
movl   $0x1,-0x4(%rbp)
jmp    1237 <test_strspn+0x117>
lea    0xe7d(%rip),%rdi
lea    0xe7d(%rip),%rsi
call   1040 <strspn@plt>
cmp    $0x4,%eax
je     11ac <test_strspn+0x8c>
movl   $0x1,-0x4(%rbp)
jmp    1237 <test_strspn+0x117>
lea    0xe5f(%rip),%rdi
lea    0xe55(%rip),%rsi
call   1040 <strspn@plt>
cmp    $0x4,%eax
je     11d4 <test_strspn+0xb4>
movl   $0x1,-0x4(%rbp)
jmp    1237 <test_strspn+0x117>
lea    0xe2d(%rip),%rdi
lea    0xe37(%rip),%rsi
call   1040 <strspn@plt>
cmp    $0x6,%eax
je     11fc <test_strspn+0xdc>
movl   $0x1,-0x4(%rbp)
jmp    1237 <test_strspn+0x117>
lea    0xe05(%rip),%rdi
lea    0xe13(%rip),%rsi
call   1040 <strspn@plt>
cmp    $0x6,%eax
je     1224 <test_strspn+0x104>
movl   $0x1,-0x4(%rbp)
jmp    1237 <test_strspn+0x117>
lea    0xdf6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strspn>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\09strspn\00"
@.str.1 = [7 x i8] c"aabbcc\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [3 x i8] c"ab\00"
@.str.4 = [3 x i8] c"ba\00"
@.str.5 = [7 x i8] c"ababcc\00"
@.str.6 = [4 x i8] c"abc\00"
@.str.7 = [4 x i8] c"cab\00"
@.str.8 = [10 x i8] c"\09passed.\0A\00"
define i32 @test_strspn() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @strspn(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%4 = icmp ne i32 %3, 2
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 1, i32* %1
br label %28
6: ; preds = %0
%7 = call i32 @strspn(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%8 = icmp ne i32 %7, 4
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %1
br label %28
10: ; preds = %6
%11 = call i32 @strspn(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%12 = icmp ne i32 %11, 4
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %1
br label %28
14: ; preds = %10
%15 = call i32 @strspn(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp ne i32 %15, 4
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 1, i32* %1
br label %28
18: ; preds = %14
%19 = call i32 @strspn(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%20 = icmp ne i32 %19, 6
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 1, i32* %1
br label %28
22: ; preds = %18
%23 = call i32 @strspn(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%24 = icmp ne i32 %23, 6
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 1, i32* %1
br label %28
26: ; preds = %22
%27 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %1
br label %28
28: ; preds = %26, %25, %21, %17, %13, %9, %5
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str = [8 x i8] c"\09strspn\00"
@str = [9 x i8] c"\09passed.\00"
define i32 @test_strspn() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret i32 0
}