#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 protoA_retFrameLen(unsigned char *, unsigned short);
unsigned char protoA_retFrame(unsigned char *buf, unsigned short bufSize,
                              unsigned char msgType, unsigned char seq) {
  unsigned char data;
  if (protoA_retFrameLen(buf, bufSize) == 0x01)
    return 0x01;
  data = buf[27];
  if (0x01 != data)
    return 0x01;
  data = buf[19];
  if (data != msgType)
    return 0x01;
  return 0x00;
}


x86 assembly (clang, -O0):
<protoA_retFrame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %si,%dx
mov    %rdi,-0x10(%rbp)
mov    %dx,-0x12(%rbp)
mov    %cl,-0x13(%rbp)
mov    %al,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
movzwl -0x12(%rbp),%esi
call   1030 <protoA_retFrameLen@plt>
cmp    $0x1,%eax
jne    114c <protoA_retFrame+0x3c>
movb   $0x1,-0x1(%rbp)
jmp    1197 <protoA_retFrame+0x87>
mov    -0x10(%rbp),%rax
mov    0x1b(%rax),%al
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
je     1170 <protoA_retFrame+0x60>
movb   $0x1,-0x1(%rbp)
jmp    1197 <protoA_retFrame+0x87>
mov    -0x10(%rbp),%rax
mov    0x13(%rax),%al
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%eax
movzbl -0x13(%rbp),%ecx
cmp    %ecx,%eax
je     1193 <protoA_retFrame+0x83>
movb   $0x1,-0x1(%rbp)
jmp    1197 <protoA_retFrame+0x87>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<protoA_retFrame>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
call   1030 <protoA_retFrameLen@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x1,%ecx
je     1133 <protoA_retFrame+0x23>
cmpb   $0x1,0x1b(%rbx)
jne    1133 <protoA_retFrame+0x23>
cmp    %bpl,0x13(%rbx)
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @protoA_retFrame(i8* %0, i16 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i8
%6 = alloca i8*
%7 = alloca i16
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
store i8* %0, i8** %6
store i16 %1, i16* %7
store i8 %2, i8* %8
store i8 %3, i8* %9
%11 = load i8*, i8** %6
%12 = load i16, i16* %7
%13 = call i32 @protoA_retFrameLen(i8* %11, i16 zeroext %12)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %4
store i8 1, i8* %5
br label %35
16: ; preds = %4
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i64 27
%19 = load i8, i8* %18
store i8 %19, i8* %10
%20 = load i8, i8* %10
%21 = zext i8 %20 to i32
%22 = icmp ne i32 1, %21
br i1 %22, label %23, label %24
23: ; preds = %16
store i8 1, i8* %5
br label %35
24: ; preds = %16
%25 = load i8*, i8** %6
%26 = getelementptr inbounds i8, i8* %25, i64 19
%27 = load i8, i8* %26
store i8 %27, i8* %10
%28 = load i8, i8* %10
%29 = zext i8 %28 to i32
%30 = load i8, i8* %8
%31 = zext i8 %30 to i32
%32 = icmp ne i32 %29, %31
br i1 %32, label %33, label %34
33: ; preds = %24
store i8 1, i8* %5
br label %35
34: ; preds = %24
store i8 0, i8* %5
br label %35
35: ; preds = %34, %33, %23, %15
%36 = load i8, i8* %5
ret i8 %36
}

LLVM IR (-O2):
define zeroext i8 @protoA_retFrame(i8* %0, i16 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = tail call i32 @protoA_retFrameLen(i8* %0, i16 zeroext %1)
%6 = icmp eq i32 %5, 1
br i1 %6, label %16, label %7
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 27
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 1
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %0, i64 19
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, %2
%15 = zext i1 %14 to i8
br label %16
16: ; preds = %11, %7, %4
%17 = phi i8 [ 1, %4 ], [ 1, %7 ], [ %15, %11 ]
ret i8 %17
}