#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 my_strcspn(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int strlen(char *);
void t_two() {
  char str[] = "fcbaas";
  char keys[] = "1234567890";
  int i;
  i = my_strcspn(str, keys);
  printf("strlen %d\n", strlen(str));
  printf("The first number in str is at position %d. \n", i + 1);
}


x86 assembly (clang, -O0):
<t_two>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xec2(%rip),%eax
mov    %eax,-0x7(%rbp)
mov    0xebc(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xeb4(%rip),%al
mov    %al,-0x1(%rbp)
mov    0xeab(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xea8(%rip),%ax
mov    %ax,-0xa(%rbp)
mov    0xea0(%rip),%al
mov    %al,-0x8(%rbp)
lea    -0x7(%rbp),%rdi
lea    -0x12(%rbp),%rsi
call   1050 <my_strcspn@plt>
mov    %eax,-0x18(%rbp)
lea    -0x7(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
add    $0x1,%esi
lea    0xe75(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_two>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movl   $0x736161,0x3(%rsp)
movl   $0x61626366,(%rsp)
movabs $0x3837363534333231,%rax
36 37 38
mov    %rax,0x8(%rsp)
movl   $0x303938,0xf(%rsp)
mov    %rsp,%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <my_strcspn@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xe95(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x1,%ebp
lea    0xe8f(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.t_two.str = [7 x i8] c"fcbaas\00"
@__const.t_two.keys = [11 x i8] c"1234567890\00"
@.str = [11 x i8] c"strlen %d\0A\00"
@.str.1 = [45 x i8] c"The first number in str is at position %d. \0A\00"
define void @t_two() {
%1 = alloca [7 x i8]
%2 = alloca [11 x i8]
%3 = alloca i32
%4 = bitcast [7 x i8]* %1 to i8*
%5 = bitcast [11 x i8]* %2 to i8*
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%8 = call i32 @my_strcspn(i8* %6, i8* %7)
store i32 %8, i32* %3
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
%14 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %13)
ret void
}

LLVM IR (-O2):
@__const.t_two.str = [7 x i8] c"fcbaas\00"
@__const.t_two.keys = [11 x i8] c"1234567890\00"
@.str = [11 x i8] c"strlen %d\0A\00"
@.str.1 = [45 x i8] c"The first number in str is at position %d. \0A\00"
define void @t_two() {
%1 = alloca [7 x i8]
%2 = alloca [11 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%5 = call i32 @my_strcspn(i8* %3, i8* %4)
%6 = call i32 @strlen(i8* %3)
%7 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = add nsw i32 %5, 1
%9 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret void
}