#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 scalar_t__ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ derive_first_word(scalar_t__ const, char const *,
                                     scalar_t__ *, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
scalar_t__ strlen(char const *);
void derive_first_word_quiz() {
  const char *text = "tcatcaclahkxih";
  const uint8_t size = (uint8_t)strlen(text);
  char DAT_word[0x05 + 1];
  uint8_t DAT_word_GEN_size = (uint8_t)0x05;
  memset(DAT_word, 0, 0x05 + 1);
  derive_first_word(size, text, &DAT_word_GEN_size, DAT_word);
  assert(strcmp(DAT_word, "tcat") == 0);
  assert(DAT_word_GEN_size == (uint8_t)4);
  printf("NOM derive first word PFV quiz ESS success REAL\n");
}


x86 assembly (clang, -O0):
<derive_first_word_quiz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x10(%rbp)
movq   $0x5,-0x20(%rbp)
lea    -0x16(%rbp),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1060 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    -0x16(%rbp),%rcx
lea    -0x20(%rbp),%rdx
call   1030 <derive_first_word@plt>
lea    -0x16(%rbp),%rdi
lea    0xe57(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
cmpq   $0x4,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    0xe2d(%rip),%rdi
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<derive_first_word_quiz>:
push   %rbx
sub    $0x10,%rsp
movq   $0x5,(%rsp)
lea    0xa(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1050 <memset@plt>
lea    0xe88(%rip),%rsi
mov    %rsp,%rdx
mov    $0xe,%edi
mov    %rbx,%rcx
call   1040 <derive_first_word@plt>
lea    0xe80(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
xor    %edi,%edi
cmpq   $0x4,(%rsp)
sete   %dil
call   1070 <assert@plt>
lea    0xe58(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"tcatcaclahkxih\00"
@.str.1 = [5 x i8] c"tcat\00"
@.str.2 = [49 x i8] c"NOM derive first word PFV quiz ESS success REAL\0A\00"
define void @derive_first_word_quiz() {
%1 = alloca i8*
%2 = alloca i64
%3 = alloca [6 x i8]
%4 = alloca i64
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %1
%5 = load i8*, i8** %1
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %2
store i64 5, i64* %4
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 6)
%9 = load i64, i64* %2
%10 = load i8*, i8** %1
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%12 = call i32 @derive_first_word(i64 %9, i8* %10, i64* %4, i8* %11)
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i64, i64* %4
%19 = icmp eq i64 %18, 4
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"tcatcaclahkxih\00"
@.str.1 = [5 x i8] c"tcat\00"
@str = [48 x i8] c"NOM derive first word PFV quiz ESS success REAL\00"
define void @derive_first_word_quiz() {
%1 = alloca [6 x i8]
%2 = alloca i64
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%4 = bitcast i64* %2 to i8*
store i64 5, i64* %2
%5 = call i32 @memset(i8* %3, i32 0, i32 6)
%6 = call i32 @derive_first_word(i64 14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64* %2, i8* %3)
%7 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i64, i64* %2
%12 = icmp eq i64 %11, 4
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
ret void
}