#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 find_in_unsorted_vocabulary(char **, int, char *);
char *strtok(char *, char *);
int parse_transcription_str(char *transcription_str, char **phonemes_vocabulary,
                            int phonemes_number, int phonemes_sequence[]) {
  char *phoneme_name = NULL;
  int i = 0, is_ok = 1;
  if ((transcription_str == NULL) || (phonemes_vocabulary == NULL) ||
      (phonemes_number <= 0) || (phonemes_sequence == NULL)) {
    return 0;
  }
  phoneme_name = strtok(transcription_str, " \t");
  if (phoneme_name == NULL) {
    return 0;
  }
  phonemes_sequence[i] = find_in_unsorted_vocabulary(
      phonemes_vocabulary, phonemes_number, phoneme_name);
  if (phonemes_sequence[i] < 0) {
    return 0;
  }
  i++;
  phoneme_name = strtok(NULL, " \t");
  while (phoneme_name != NULL) {
    phonemes_sequence[i] = find_in_unsorted_vocabulary(
        phonemes_vocabulary, phonemes_number, phoneme_name);
    if (phonemes_sequence[i] < 0) {
      is_ok = 0;
      break;
    }
    i++;
    phoneme_name = strtok(NULL, " \t");
  }
  if (!is_ok) {
    return 0;
  }
  return i;
}


x86 assembly (clang, -O0):
<parse_transcription_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x1,-0x38(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1178 <parse_transcription_str+0x58>
cmpq   $0x0,-0x18(%rbp)
je     1178 <parse_transcription_str+0x58>
cmpl   $0x0,-0x1c(%rbp)
jle    1178 <parse_transcription_str+0x58>
cmpq   $0x0,-0x28(%rbp)
jne    1184 <parse_transcription_str+0x64>
movl   $0x0,-0x4(%rbp)
jmp    128b <parse_transcription_str+0x16b>
mov    -0x10(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11af <parse_transcription_str+0x8f>
movl   $0x0,-0x4(%rbp)
jmp    128b <parse_transcription_str+0x16b>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1030 <find_in_unsorted_vocabulary@plt>
mov    %eax,%edx
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jge    11ea <parse_transcription_str+0xca>
movl   $0x0,-0x4(%rbp)
jmp    128b <parse_transcription_str+0x16b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe02(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     126f <parse_transcription_str+0x14f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x30(%rbp),%rdx
call   1030 <find_in_unsorted_vocabulary@plt>
mov    %eax,%edx
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jge    124d <parse_transcription_str+0x12d>
movl   $0x0,-0x38(%rbp)
jmp    126f <parse_transcription_str+0x14f>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xd9f(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x30(%rbp)
jmp    1207 <parse_transcription_str+0xe7>
cmpl   $0x0,-0x38(%rbp)
jne    1285 <parse_transcription_str+0x165>
movl   $0x0,-0x4(%rbp)
jmp    128b <parse_transcription_str+0x16b>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_transcription_str>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
test   %rdi,%rdi
je     11e4 <parse_transcription_str+0xc4>
mov    %rsi,%rbx
test   %rsi,%rsi
je     11e4 <parse_transcription_str+0xc4>
mov    %edx,%r13d
test   %edx,%edx
jle    11e4 <parse_transcription_str+0xc4>
mov    %rcx,%r15
test   %rcx,%rcx
je     11e4 <parse_transcription_str+0xc4>
lea    0xe9f(%rip),%rsi
call   1040 <strtok@plt>
test   %rax,%rax
je     11e4 <parse_transcription_str+0xc4>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %rax,%rdx
call   1030 <find_in_unsorted_vocabulary@plt>
mov    %eax,(%r15)
test   %eax,%eax
js     11e4 <parse_transcription_str+0xc4>
lea    0xe79(%rip),%rsi
xor    %edi,%edi
call   1040 <strtok@plt>
test   %rax,%rax
je     11de <parse_transcription_str+0xbe>
mov    $0x1,%ebp
lea    0xe61(%rip),%r12
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %rax,%rdx
call   1030 <find_in_unsorted_vocabulary@plt>
mov    %eax,(%r15,%rbp,4)
test   %eax,%eax
js     11e4 <parse_transcription_str+0xc4>
add    $0x1,%rbp
xor    %edi,%edi
mov    %r12,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
jne    11b0 <parse_transcription_str+0x90>
mov    %ebp,%r14d
jmp    11e4 <parse_transcription_str+0xc4>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \09\00"
define i32 @parse_transcription_str(i8* %0, i8** %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %6
store i8** %1, i8*** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i8* null, i8** %10
store i32 0, i32* %11
store i32 1, i32* %12
%13 = load i8*, i8** %6
%14 = icmp eq i8* %13, null
br i1 %14, label %24, label %15
15: ; preds = %4
%16 = load i8**, i8*** %7
%17 = icmp eq i8** %16, null
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = load i32, i32* %8
%20 = icmp sle i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32*, i32** %9
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %25
24: ; preds = %21, %18, %15, %4
store i32 0, i32* %5
br label %80
25: ; preds = %21
%26 = load i8*, i8** %6
%27 = call i8* @strtok(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %27, i8** %10
%28 = load i8*, i8** %10
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 0, i32* %5
br label %80
31: ; preds = %25
%32 = load i8**, i8*** %7
%33 = load i32, i32* %8
%34 = load i8*, i8** %10
%35 = call i32 @find_in_unsorted_vocabulary(i8** %32, i32 %33, i8* %34)
%36 = load i32*, i32** %9
%37 = load i32, i32* %11
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
store i32 %35, i32* %39
%40 = load i32*, i32** %9
%41 = load i32, i32* %11
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
%44 = load i32, i32* %43
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %31
store i32 0, i32* %5
br label %80
47: ; preds = %31
%48 = load i32, i32* %11
%49 = add nsw i32 %48, 1
store i32 %49, i32* %11
%50 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %50, i8** %10
br label %51
51: ; preds = %70, %47
%52 = load i8*, i8** %10
%53 = icmp ne i8* %52, null
br i1 %53, label %54, label %74
54: ; preds = %51
%55 = load i8**, i8*** %7
%56 = load i32, i32* %8
%57 = load i8*, i8** %10
%58 = call i32 @find_in_unsorted_vocabulary(i8** %55, i32 %56, i8* %57)
%59 = load i32*, i32** %9
%60 = load i32, i32* %11
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i32, i32* %59, i64 %61
store i32 %58, i32* %62
%63 = load i32*, i32** %9
%64 = load i32, i32* %11
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %63, i64 %65
%67 = load i32, i32* %66
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %70
69: ; preds = %54
store i32 0, i32* %12
br label %74
70: ; preds = %54
%71 = load i32, i32* %11
%72 = add nsw i32 %71, 1
store i32 %72, i32* %11
%73 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %73, i8** %10
br label %51
74: ; preds = %69, %51
%75 = load i32, i32* %12
%76 = icmp ne i32 %75, 0
br i1 %76, label %78, label %77
77: ; preds = %74
store i32 0, i32* %5
br label %80
78: ; preds = %74
%79 = load i32, i32* %11
store i32 %79, i32* %5
br label %80
80: ; preds = %78, %77, %46, %30, %24
%81 = load i32, i32* %5
ret i32 %81
}

LLVM IR (-O2):
@.str = [3 x i8] c" \09\00"
define i32 @parse_transcription_str(i8* %0, i8** %1, i32 %2, i32* writeonly %3) {
%5 = icmp eq i8* %0, null
%6 = icmp eq i8** %1, null
%7 = or i1 %5, %6
%8 = icmp slt i32 %2, 1
%9 = or i1 %7, %8
%10 = icmp eq i32* %3, null
%11 = or i1 %9, %10
br i1 %11, label %33, label %12
12: ; preds = %4
%13 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i8* %13, null
br i1 %14, label %33, label %15
15: ; preds = %12
%16 = tail call i32 @find_in_unsorted_vocabulary(i8** %1, i32 %2, i8* %13)
store i32 %16, i32* %3
%17 = icmp slt i32 %16, 0
br i1 %17, label %33, label %18
18: ; preds = %15
%19 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i8* %19, null
br i1 %20, label %33, label %21
21: ; preds = %18, %27
%22 = phi i64 [ %28, %27 ], [ 1, %18 ]
%23 = phi i8* [ %29, %27 ], [ %19, %18 ]
%24 = tail call i32 @find_in_unsorted_vocabulary(i8** %1, i32 %2, i8* %23)
%25 = getelementptr inbounds i32, i32* %3, i64 %22
store i32 %24, i32* %25
%26 = icmp slt i32 %24, 0
br i1 %26, label %33, label %27
27: ; preds = %21
%28 = add nuw i64 %22, 1
%29 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %21
31: ; preds = %27
%32 = trunc i64 %28 to i32
br label %33
33: ; preds = %21, %31, %18, %15, %12, %4
%34 = phi i32 [ 0, %4 ], [ 0, %12 ], [ 0, %15 ], [ 1, %18 ], [ %32, %31 ], [ 0, %21 ]
ret i32 %34
}