#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 */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;
struct can_frame {
  int dummy;
};

/* Variables and functions */
int cs(struct can_frame);
scalar_t__ is_expected_canopen_object(struct can_frame *, int /*<<< orphan*/,
                                      int /*<<< orphan*/);
int is_upload_initiate_response(struct can_frame frame, uint16_t index,
                                uint8_t subindex) {
  return cs(frame) == 2 && is_expected_canopen_object(&frame, index, subindex);
}


x86 assembly (clang, -O0):
<is_upload_initiate_response>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <cs@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
mov    %al,-0x11(%rbp)
jne    1162 <is_upload_initiate_response+0x42>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    -0x8(%rbp),%rdi
call   1030 <is_expected_canopen_object@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_upload_initiate_response>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,(%rsp)
call   1040 <cs@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
jne    114f <is_upload_initiate_response+0x2f>
mov    %rsp,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <is_expected_canopen_object@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.can_frame = type { i32 }
define i32 @is_upload_initiate_response(i32 %0, i32 %1, i32 %2) {
%4 = alloca %struct.can_frame
%5 = alloca i32
%6 = alloca i32
%7 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %4, i32 0, i32 0
store i32 %0, i32* %7
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %4, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @cs(i32 %9)
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i64 @is_expected_canopen_object(%struct.can_frame* %4, i32 %13, i32 %14)
%16 = icmp ne i64 %15, 0
br label %17
17: ; preds = %12, %3
%18 = phi i1 [ false, %3 ], [ %16, %12 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
%struct.can_frame = type { i32 }
define i32 @is_upload_initiate_response(i32 %0, i32 %1, i32 %2) {
%4 = alloca %struct.can_frame
%5 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %4, i64 0, i32 0
store i32 %0, i32* %5
%6 = tail call i32 @cs(i32 %0)
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = call i64 @is_expected_canopen_object(%struct.can_frame* %4, i32 %1, i32 %2)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %8, %3
%13 = phi i32 [ 0, %3 ], [ %11, %8 ]
ret i32 %13
}