#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 */
struct katcp_dispatch {
  int dummy;
};
struct katcp_dict {
  int dummy;
};
struct katcl_parse {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ destroy_dict_type_katcp(struct katcp_dict *);
int /*<<< orphan*/ free(char **);
struct katcp_dict *parse_dict_type_katcp(struct katcp_dispatch *, char **);
char **parse_to_data_vector_katcp(struct katcl_parse *, int);
struct katcp_dict *search_named_type_katcp(struct katcp_dispatch *, char *,
                                           char *, struct katcp_dict *);
int dict_katcp(struct katcp_dispatch *d, struct katcl_parse *p) {
  struct katcp_dict *dt, *temp;
  char **data;
  data = parse_to_data_vector_katcp(p, 1);
  if (data == NULL)
    return -1;
  dt = parse_dict_type_katcp(d, data);
  if (dt == NULL) {
    free(data);
    return -1;
  }
  temp = search_named_type_katcp(d, "dict", data[0], dt);
  if (temp == NULL) {
    destroy_dict_type_katcp(dt);
    return -1;
  }
  free(data);
  return 0;
}


x86 assembly (clang, -O0):
<dict_katcp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1070 <parse_to_data_vector_katcp@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1189 <dict_katcp+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    1209 <dict_katcp+0xb9>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1050 <parse_dict_type_katcp@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11ba <dict_katcp+0x6a>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1209 <dict_katcp+0xb9>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe30(%rip),%rsi
call   1040 <search_named_type_katcp@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11f9 <dict_katcp+0xa9>
mov    -0x20(%rbp),%rdi
call   1060 <destroy_dict_type_katcp@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1209 <dict_katcp+0xb9>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dict_katcp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
mov    %rsi,%rdi
mov    $0x1,%esi
call   1070 <parse_to_data_vector_katcp@plt>
mov    $0xffffffff,%r14d
test   %rax,%rax
je     11c1 <dict_katcp+0x71>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1050 <parse_dict_type_katcp@plt>
test   %rax,%rax
je     11af <dict_katcp+0x5f>
mov    %rax,%rbp
mov    (%rbx),%rdx
lea    0xe6e(%rip),%rsi
mov    %r15,%rdi
mov    %rax,%rcx
call   1040 <search_named_type_katcp@plt>
test   %rax,%rax
je     11b9 <dict_katcp+0x69>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %r14d,%r14d
jmp    11c1 <dict_katcp+0x71>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    11c1 <dict_katcp+0x71>
mov    %rbp,%rdi
call   1060 <destroy_dict_type_katcp@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.katcp_dispatch = type { i32 }
%struct.katcl_parse = type { i32 }
%struct.katcp_dict = type { i32 }
@.str = [5 x i8] c"dict\00"
define i32 @dict_katcp(%struct.katcp_dispatch* %0, %struct.katcl_parse* %1) {
%3 = alloca i32
%4 = alloca %struct.katcp_dispatch*
%5 = alloca %struct.katcl_parse*
%6 = alloca %struct.katcp_dict*
%7 = alloca %struct.katcp_dict*
%8 = alloca i8**
store %struct.katcp_dispatch* %0, %struct.katcp_dispatch** %4
store %struct.katcl_parse* %1, %struct.katcl_parse** %5
%9 = load %struct.katcl_parse*, %struct.katcl_parse** %5
%10 = call i8** @parse_to_data_vector_katcp(%struct.katcl_parse* %9, i32 1)
store i8** %10, i8*** %8
%11 = load i8**, i8*** %8
%12 = icmp eq i8** %11, null
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %38
14: ; preds = %2
%15 = load %struct.katcp_dispatch*, %struct.katcp_dispatch** %4
%16 = load i8**, i8*** %8
%17 = call %struct.katcp_dict* @parse_dict_type_katcp(%struct.katcp_dispatch* %15, i8** %16)
store %struct.katcp_dict* %17, %struct.katcp_dict** %6
%18 = load %struct.katcp_dict*, %struct.katcp_dict** %6
%19 = icmp eq %struct.katcp_dict* %18, null
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = load i8**, i8*** %8
%22 = call i32 @free(i8** %21)
store i32 -1, i32* %3
br label %38
23: ; preds = %14
%24 = load %struct.katcp_dispatch*, %struct.katcp_dispatch** %4
%25 = load i8**, i8*** %8
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = load %struct.katcp_dict*, %struct.katcp_dict** %6
%29 = call %struct.katcp_dict* @search_named_type_katcp(%struct.katcp_dispatch* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %27, %struct.katcp_dict* %28)
store %struct.katcp_dict* %29, %struct.katcp_dict** %7
%30 = load %struct.katcp_dict*, %struct.katcp_dict** %7
%31 = icmp eq %struct.katcp_dict* %30, null
br i1 %31, label %32, label %35
32: ; preds = %23
%33 = load %struct.katcp_dict*, %struct.katcp_dict** %6
%34 = call i32 @destroy_dict_type_katcp(%struct.katcp_dict* %33)
store i32 -1, i32* %3
br label %38
35: ; preds = %23
%36 = load i8**, i8*** %8
%37 = call i32 @free(i8** %36)
store i32 0, i32* %3
br label %38
38: ; preds = %35, %32, %20, %13
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
%struct.katcp_dispatch = type { i32 }
%struct.katcl_parse = type { i32 }
%struct.katcp_dict = type { i32 }
@.str = [5 x i8] c"dict\00"
define i32 @dict_katcp(%struct.katcp_dispatch* %0, %struct.katcl_parse* %1) {
%3 = tail call i8** @parse_to_data_vector_katcp(%struct.katcl_parse* %1, i32 1)
%4 = icmp eq i8** %3, null
br i1 %4, label %18, label %5
5: ; preds = %2
%6 = tail call %struct.katcp_dict* @parse_dict_type_katcp(%struct.katcp_dispatch* %0, i8** %3)
%7 = icmp eq %struct.katcp_dict* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @free(i8** %3)
br label %18
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = tail call %struct.katcp_dict* @search_named_type_katcp(%struct.katcp_dispatch* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %11, %struct.katcp_dict* %6)
%13 = icmp eq %struct.katcp_dict* %12, null
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i32 @destroy_dict_type_katcp(%struct.katcp_dict* %6)
br label %18
16: ; preds = %10
%17 = tail call i32 @free(i8** %3)
br label %18
18: ; preds = %2, %16, %14, %8
%19 = phi i32 [ -1, %8 ], [ -1, %14 ], [ 0, %16 ], [ -1, %2 ]
ret i32 %19
}