#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 strcspn(char *, char *);
int test_strcspn(void) {
  printf("\tstrcspn");
  if (strcspn("aabbcc", "bca") != 0)
    return 1;
  if (strcspn("aabbcc", "bc") != 2)
    return 1;
  if (strcspn("aabbcc", "cb") != 2)
    return 1;
  if (strcspn("aabbcc", "c") != 4)
    return 1;
  if (strcspn("aabbcc", "d") != 6)
    return 1;
  printf("\tpassed.\n");
  return 0;
}


x86 assembly (clang, -O0):
<test_strcspn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    0xece(%rip),%rsi
call   1040 <strcspn@plt>
cmp    $0x0,%eax
je     115c <test_strcspn+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    120f <test_strcspn+0xef>
lea    0xea6(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1040 <strcspn@plt>
cmp    $0x2,%eax
je     1184 <test_strcspn+0x64>
movl   $0x1,-0x4(%rbp)
jmp    120f <test_strcspn+0xef>
lea    0xe7e(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1040 <strcspn@plt>
cmp    $0x2,%eax
je     11ac <test_strcspn+0x8c>
movl   $0x1,-0x4(%rbp)
jmp    120f <test_strcspn+0xef>
lea    0xe56(%rip),%rdi
lea    0xe5b(%rip),%rsi
call   1040 <strcspn@plt>
cmp    $0x4,%eax
je     11d4 <test_strcspn+0xb4>
movl   $0x1,-0x4(%rbp)
jmp    120f <test_strcspn+0xef>
lea    0xe2e(%rip),%rdi
lea    0xe38(%rip),%rsi
call   1040 <strcspn@plt>
cmp    $0x6,%eax
je     11fc <test_strcspn+0xdc>
movl   $0x1,-0x4(%rbp)
jmp    120f <test_strcspn+0xef>
lea    0xe19(%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_strcspn>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"\09strcspn\00"
@.str.1 = [7 x i8] c"aabbcc\00"
@.str.2 = [4 x i8] c"bca\00"
@.str.3 = [3 x i8] c"bc\00"
@.str.4 = [3 x i8] c"cb\00"
@.str.5 = [2 x i8] c"c\00"
@.str.6 = [2 x i8] c"d\00"
@.str.7 = [10 x i8] c"\09passed.\0A\00"
define i32 @test_strcspn() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @strcspn(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.2, i64 0, i64 0))
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 1, i32* %1
br label %24
6: ; preds = %0
%7 = call i32 @strcspn(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, 2
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %1
br label %24
10: ; preds = %6
%11 = call i32 @strcspn(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, 2
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %1
br label %24
14: ; preds = %10
%15 = call i32 @strcspn(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.5, 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 %24
18: ; preds = %14
%19 = call i32 @strcspn(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.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 %24
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %1
br label %24
24: ; preds = %22, %21, %17, %13, %9, %5
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [9 x i8] c"\09strcspn\00"
@str = [9 x i8] c"\09passed.\00"
define i32 @test_strcspn() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 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
}