#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 stun_get_method_str(unsigned char const *, size_t);
scalar_t__ stun_is_command_message_str(unsigned char const *, size_t);
scalar_t__ stun_is_response_str(unsigned char const *, size_t);
int stun_is_binding_response_str(const unsigned char *buf, size_t len) {
  if (stun_is_command_message_str(buf, len) &&
      (stun_get_method_str(buf, len) == (0x0001))) {
    if (stun_is_response_str(buf, len)) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<stun_is_binding_response_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <stun_is_command_message_str@plt>
cmp    $0x0,%rax
je     1195 <stun_is_binding_response_str+0x65>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <stun_get_method_str@plt>
cmp    $0x1,%eax
jne    1195 <stun_is_binding_response_str+0x65>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <stun_is_response_str@plt>
cmp    $0x0,%rax
je     1190 <stun_is_binding_response_str+0x60>
movl   $0x1,-0x4(%rbp)
jmp    119c <stun_is_binding_response_str+0x6c>
jmp    1195 <stun_is_binding_response_str+0x65>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stun_is_binding_response_str>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <stun_is_command_message_str@plt>
test   %rax,%rax
je     116c <stun_is_binding_response_str+0x3c>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <stun_get_method_str@plt>
cmp    $0x1,%eax
jne    116c <stun_is_binding_response_str+0x3c>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <stun_is_response_str@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    116e <stun_is_binding_response_str+0x3e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @stun_is_binding_response_str(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%6 = load i8*, i8** %4
%7 = load i64, i64* %5
%8 = call i64 @stun_is_command_message_str(i8* %6, i64 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = load i64, i64* %5
%13 = call i32 @stun_get_method_str(i8* %11, i64 %12)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %22
15: ; preds = %10
%16 = load i8*, i8** %4
%17 = load i64, i64* %5
%18 = call i64 @stun_is_response_str(i8* %16, i64 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 1, i32* %3
br label %23
21: ; preds = %15
br label %22
22: ; preds = %21, %10, %2
store i32 0, i32* %3
br label %23
23: ; preds = %22, %20
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @stun_is_binding_response_str(i8* %0, i64 %1) {
%3 = tail call i64 @stun_is_command_message_str(i8* %0, i64 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = tail call i32 @stun_get_method_str(i8* %0, i64 %1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i64 @stun_is_response_str(i8* %0, i64 %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8, %5, %2
br label %12
12: ; preds = %8, %11
%13 = phi i32 [ 0, %11 ], [ 1, %8 ]
ret i32 %13
}