#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 */
typedef int /*<<< orphan*/ src;
typedef int /*<<< orphan*/ dst;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stdin;
int strcspn(char *, char *);
int strspn(char *, char *);
char *strtok(char *, char *);
int main(void) {
  char src[128], dst[128];
  char flag = 'y';
  while (flag != 'n') {
    printf("input the first string source string\n");
    fgets(src, sizeof(src), stdin);
    printf("input the second string destenation string\n");
    scanf("%*c");
    fgets(dst, sizeof(dst), stdin);
    printf("============================================================\n");
    printf("strspn of src and dst is:\n");
    printf("\t %d\n", strspn(src, dst));
    printf("strcspn of src and dst is:\n");
    printf("\t %d\n", strcspn(src, dst));
    printf("============================================================\n");
    printf("strtok function:\n");
    printf("src and dst partitioning by ' ':\n");
    printf("\t %s\t%s\n", strtok(src, " "), strtok(dst, " "));
    printf("============================================================\n");
    printf("Continue or not?(y/n):");
    scanf(" %c%*c", &flag);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x79,-0x111(%rbp)
movsbl -0x111(%rbp),%eax
cmp    $0x6e,%eax
je     12fc <main+0x19c>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
mov    0x2e43(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1060 <fgets@plt>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf60(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e0d(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1060 <fgets@plt>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1040 <strspn@plt>
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1050 <strcspn@plt>
mov    %eax,%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
lea    0xe7b(%rip),%rsi
call   1080 <strtok@plt>
mov    %rax,-0x120(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1080 <strtok@plt>
mov    -0x120(%rbp),%rsi
mov    %rax,%rdx
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3a(%rip),%rdi
lea    -0x111(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
jmp    1179 <main+0x19>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
movb   $0x79,0xf(%rsp)
lea    0x90(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0xf4c(%rip),%r15
lea    0xe6e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe78(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e25(%rip),%rbp
mov    0x0(%rbp),%edx
mov    %r13,%rdi
mov    $0x80,%esi
call   1070 <fgets@plt>
lea    0xe7a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe45(%rip),%rdi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1070 <fgets@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xe73(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <strspn@plt>
lea    0xddd(%rip),%rbp
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe63(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <strcspn@plt>
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
lea    0xe58(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1090 <strtok@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <strtok@plt>
lea    0xd74(%rip),%rdi
mov    %r12,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
lea    0xd63(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd6c(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
cmpb   $0x6e,0xf(%rsp)
jne    11b0 <main+0x40>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"input the first string source string\0A\00"
@stdin = global i32 0
@.str.1 = [44 x i8] c"input the second string destenation string\0A\00"
@.str.2 = [4 x i8] c"%*c\00"
@.str.3 = [62 x i8] c"============================================================\0A\00"
@.str.4 = [27 x i8] c"strspn of src and dst is:\0A\00"
@.str.5 = [6 x i8] c"\09 %d\0A\00"
@.str.6 = [28 x i8] c"strcspn of src and dst is:\0A\00"
@.str.7 = [18 x i8] c"strtok function:\0A\00"
@.str.8 = [34 x i8] c"src and dst partitioning by ' ':\0A\00"
@.str.9 = [9 x i8] c"\09 %s\09%s\0A\00"
@.str.10 = [2 x i8] c" \00"
@.str.11 = [23 x i8] c"Continue or not?(y/n):\00"
@.str.12 = [7 x i8] c" %c%*c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca [128 x i8]
%4 = alloca i8
store i32 0, i32* %1
store i8 121, i8* %4
br label %5
5: ; preds = %9, %0
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 110
br i1 %8, label %9, label %41
9: ; preds = %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %11, i32 128, i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%17 = load i32, i32* @stdin
%18 = call i32 @fgets(i8* %16, i32 128, i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%21 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%23 = call i32 @strspn(i8* %21, i8* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%26 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%27 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%28 = call i32 @strcspn(i8* %26, i8* %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%33 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%34 = call i8* @strtok(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%35 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%36 = call i8* @strtok(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %34, i8* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.3, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%40 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* %4)
br label %5
41: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.2 = [4 x i8] c"%*c\00"
@.str.5 = [6 x i8] c"\09 %d\0A\00"
@.str.9 = [9 x i8] c"\09 %s\09%s\0A\00"
@.str.10 = [2 x i8] c" \00"
@.str.11 = [23 x i8] c"Continue or not?(y/n):\00"
@.str.12 = [7 x i8] c" %c%*c\00"
@str = [37 x i8] c"input the first string source string\00"
@str.13 = [43 x i8] c"input the second string destenation string\00"
@str.15 = [26 x i8] c"strspn of src and dst is:\00"
@str.16 = [27 x i8] c"strcspn of src and dst is:\00"
@str.18 = [17 x i8] c"strtok function:\00"
@str.19 = [33 x i8] c"src and dst partitioning by ' ':\00"
@str.20 = [61 x i8] c"============================================================\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = alloca [128 x i8]
%3 = alloca i8
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
store i8 121, i8* %3
br label %6
6: ; preds = %0, %6
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %4, i32 128, i32 %8)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.13, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %5, i32 128, i32 %12)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.20, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.15, i64 0, i64 0))
%16 = call i32 @strspn(i8* %4, i8* %5)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.16, i64 0, i64 0))
%19 = call i32 @strcspn(i8* %4, i8* %5)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.20, i64 0, i64 0))
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.18, i64 0, i64 0))
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.19, i64 0, i64 0))
%24 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%25 = call i8* @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8* %24, i8* %25)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.20, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* %3)
%30 = load i8, i8* %3
%31 = icmp eq i8 %30, 110
br i1 %31, label %32, label %6
32: ; preds = %6
ret i32 0
}