#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 katcl_parse {
  int dummy;
};

/* Variables and functions */
char *get_string_parse_katcl(struct katcl_parse *, int);
scalar_t__ is_type_parse_katcl(struct katcl_parse *, char);
int /*<<< orphan*/ strcmp(char *, char *);
int is_reply_ok_parse_katcl(struct katcl_parse *p) {
  char *str;
  if (is_type_parse_katcl(p, '!')) {
    str = get_string_parse_katcl(p, 1);
    if (str) {
      if (!strcmp(str, "ok")) {
        return 1;
      } else {
        return 0;
      }
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<is_reply_ok_parse_katcl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x21,%esi
call   1050 <is_type_parse_katcl@plt>
cmp    $0x0,%rax
je     11a7 <is_reply_ok_parse_katcl+0x77>
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1030 <get_string_parse_katcl@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11a2 <is_reply_ok_parse_katcl+0x72>
mov    -0x18(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1196 <is_reply_ok_parse_katcl+0x66>
movl   $0x1,-0x4(%rbp)
jmp    11ae <is_reply_ok_parse_katcl+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    11ae <is_reply_ok_parse_katcl+0x7e>
jmp    11a7 <is_reply_ok_parse_katcl+0x77>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_reply_ok_parse_katcl>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x21,%esi
call   1050 <is_type_parse_katcl@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     1173 <is_reply_ok_parse_katcl+0x43>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <get_string_parse_katcl@plt>
test   %rax,%rax
je     1173 <is_reply_ok_parse_katcl+0x43>
lea    0xe9d(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.katcl_parse = type { i32 }
@.str = [3 x i8] c"ok\00"
define i32 @is_reply_ok_parse_katcl(%struct.katcl_parse* %0) {
%2 = alloca i32
%3 = alloca %struct.katcl_parse*
%4 = alloca i8*
store %struct.katcl_parse* %0, %struct.katcl_parse** %3
%5 = load %struct.katcl_parse*, %struct.katcl_parse** %3
%6 = call i64 @is_type_parse_katcl(%struct.katcl_parse* %5, i8 signext 33)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %1
%9 = load %struct.katcl_parse*, %struct.katcl_parse** %3
%10 = call i8* @get_string_parse_katcl(%struct.katcl_parse* %9, i32 1)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %19
13: ; preds = %8
%14 = load i8*, i8** %4
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %13
store i32 1, i32* %2
br label %21
18: ; preds = %13
store i32 0, i32* %2
br label %21
19: ; preds = %8
br label %20
20: ; preds = %19, %1
store i32 -1, i32* %2
br label %21
21: ; preds = %20, %18, %17
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
%struct.katcl_parse = type { i32 }
@.str = [3 x i8] c"ok\00"
define i32 @is_reply_ok_parse_katcl(%struct.katcl_parse* %0) {
%2 = tail call i64 @is_type_parse_katcl(%struct.katcl_parse* %0, i8 signext 33)
%3 = icmp eq i64 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i8* @get_string_parse_katcl(%struct.katcl_parse* %0, i32 1)
%6 = icmp eq i8* %5, null
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* %5, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %1, %4, %7
%12 = phi i32 [ %10, %7 ], [ -1, %4 ], [ -1, %1 ]
ret i32 %12
}