#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 uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ PN5180_transceiveCommand(int *, int, int /*<<< orphan*/,
                                            int /*<<< orphan*/);
bool PN5180A_writeRegisterWithOrMask(uint8_t reg, uint32_t mask) {
  uint8_t *p = (uint8_t *)&mask;
  uint8_t buf[6];
  buf[0] = (0x01);
  buf[1] = reg;
  buf[2] = p[0];
  buf[3] = p[1];
  buf[4] = p[2];
  buf[5] = p[3];
  PN5180_transceiveCommand(buf, 6, 0, 0);
  return true;
}


x86 assembly (clang, -O0):
<PN5180A_writeRegisterWithOrMask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x1c(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x6,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <PN5180_transceiveCommand@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PN5180A_writeRegisterWithOrMask>:
sub    $0x18,%rsp
movl   $0x1,(%rsp)
mov    %edi,0x4(%rsp)
mov    %esi,0x8(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <PN5180_transceiveCommand@plt>
mov    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @PN5180A_writeRegisterWithOrMask(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca [6 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32* %4, i32** %5
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
store i32 1, i32* %7
%8 = load i32, i32* %3
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 1
store i32 %8, i32* %9
%10 = load i32*, i32** %5
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 2
store i32 %12, i32* %13
%14 = load i32*, i32** %5
%15 = getelementptr inbounds i32, i32* %14, i64 1
%16 = load i32, i32* %15
%17 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 3
store i32 %16, i32* %17
%18 = load i32*, i32** %5
%19 = getelementptr inbounds i32, i32* %18, i64 2
%20 = load i32, i32* %19
%21 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 4
store i32 %20, i32* %21
%22 = load i32*, i32** %5
%23 = getelementptr inbounds i32, i32* %22, i64 3
%24 = load i32, i32* %23
%25 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 5
store i32 %24, i32* %25
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%27 = call i32 @PN5180_transceiveCommand(i32* %26, i32 6, i32 0, i32 0)
ret i32 1
}

LLVM IR (-O2):
define i32 @PN5180A_writeRegisterWithOrMask(i32 %0, i32 %1) {
%3 = alloca [6 x i32]
%4 = bitcast [6 x i32]* %3 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
store i32 1, i32* %5
%6 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 1
store i32 %0, i32* %6
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 2
store i32 %1, i32* %7
%8 = call i32 @PN5180_transceiveCommand(i32* %5, i32 6, i32 0, i32 0)
ret i32 1
}