#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);
int strcspn(char *, char *);
int main(int argc, char *argv[]) {
  printf("toto => %d\n", strcspn("toto", "t"));
  printf("toto => %d\n", strcspn("toto", "o"));
  printf("toto => %d\n", strcspn("toto", ""));
  printf(" => %d\n", strcspn("", "sdfsdf"));
  printf(" => %d\n", strcspn("", ""));
  printf("abcdefghijkl => %d\n", strcspn("abcdefghijkl", "ejc"));
  printf("abcdefghijkl => %d\n", strcspn("abcdefghijkl", "j"));
  printf("abcdefghijkl => %d\n", strcspn("abcdefghijkl", "l"));
  printf("abcdefghijkl => %d\n", strcspn("abcdefghijkl", "a"));
  printf("abcdefghijkl => %d\n", strcspn("i", "abcdefghijkl"));
  printf("abcdefghijkl => %d\n", strcspn("i", "abcdefghjl"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xecf(%rip),%rdi
lea    0xecd(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    0xea7(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    0xe6c(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
lea    0xe6c(%rip),%rsi
mov    %rsi,%rdi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
lea    0xe50(%rip),%rdi
lea    0xe56(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xe27(%rip),%rdi
call   1030 <printf@plt>
lea    0xe2f(%rip),%rdi
lea    0xe39(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
lea    0xe0e(%rip),%rdi
lea    0xe27(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xde5(%rip),%rdi
call   1030 <printf@plt>
lea    0xded(%rip),%rdi
lea    0xdf9(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xdc4(%rip),%rdi
call   1030 <printf@plt>
lea    0xde1(%rip),%rdi
lea    0xdc5(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xda3(%rip),%rdi
call   1030 <printf@plt>
lea    0xdc0(%rip),%rdi
lea    0xdbb(%rip),%rsi
call   1040 <strcspn@plt>
mov    %eax,%esi
lea    0xd82(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xed5(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xeae(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"toto => %d\0A\00"
@.str.1 = [5 x i8] c"toto\00"
@.str.2 = [2 x i8] c"t\00"
@.str.3 = [2 x i8] c"o\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [8 x i8] c" => %d\0A\00"
@.str.6 = [7 x i8] c"sdfsdf\00"
@.str.7 = [20 x i8] c"abcdefghijkl => %d\0A\00"
@.str.8 = [13 x i8] c"abcdefghijkl\00"
@.str.9 = [4 x i8] c"ejc\00"
@.str.10 = [2 x i8] c"j\00"
@.str.11 = [2 x i8] c"l\00"
@.str.12 = [2 x i8] c"a\00"
@.str.13 = [2 x i8] c"i\00"
@.str.14 = [11 x i8] c"abcdefghjl\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @strcspn(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @strcspn(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @strcspn(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @strcspn(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %12)
%14 = call i32 @strcspn(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %14)
%16 = call i32 @strcspn(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %16)
%18 = call i32 @strcspn(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %18)
%20 = call i32 @strcspn(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %20)
%22 = call i32 @strcspn(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %22)
%24 = call i32 @strcspn(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%25 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %24)
%26 = call i32 @strcspn(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"toto => %d\0A\00"
@.str.5 = [8 x i8] c" => %d\0A\00"
@.str.7 = [20 x i8] c"abcdefghijkl => %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 2)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 9)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 11)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 0)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 0)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 1)
ret i32 0
}