#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 /*<<< orphan*/ flash_write(unsigned char *, unsigned int, int);
int /*<<< orphan*/ mb_dev_holding_reg_wr(unsigned int, unsigned int);
void param_write(unsigned int nv_offset, unsigned int reg_offset,
                 unsigned int default_val) {
  unsigned char buff[4];
  buff[0] = (unsigned char)(default_val >> 8);
  buff[1] = (unsigned char)default_val;
  buff[2] = 0xAA;
  buff[3] = 0xAA;
  mb_dev_holding_reg_wr(reg_offset, default_val);
  flash_write(buff, nv_offset, 4);
}


x86 assembly (clang, -O0):
<param_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
mov    %al,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0xf(%rbp)
movb   $0xaa,-0xe(%rbp)
movb   $0xaa,-0xd(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <mb_dev_holding_reg_wr@plt>
lea    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x4,%edx
call   1040 <flash_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_write>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %dh,0xc(%rsp)
mov    %dl,0xd(%rsp)
movw   $0xaaaa,0xe(%rsp)
mov    %esi,%edi
mov    %edx,%esi
call   1030 <mb_dev_holding_reg_wr@plt>
lea    0xc(%rsp),%rdi
mov    %ebx,%esi
mov    $0x4,%edx
call   1040 <flash_write@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @param_write(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = lshr i32 %8, 8
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
store i8 %10, i8* %11
%12 = load i32, i32* %6
%13 = trunc i32 %12 to i8
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 1
store i8 %13, i8* %14
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 2
store i8 -86, i8* %15
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 3
store i8 -86, i8* %16
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = call i32 @mb_dev_holding_reg_wr(i32 %17, i32 %18)
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%21 = load i32, i32* %4
%22 = call i32 @flash_write(i8* %20, i32 %21, i32 4)
ret void
}

LLVM IR (-O2):
define void @param_write(i32 %0, i32 %1, i32 %2) {
%4 = alloca [4 x i8]
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%6 = lshr i32 %2, 8
%7 = trunc i32 %6 to i8
store i8 %7, i8* %5
%8 = trunc i32 %2 to i8
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 1
store i8 %8, i8* %9
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 2
store i8 -86, i8* %10
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 3
store i8 -86, i8* %11
%12 = tail call i32 @mb_dev_holding_reg_wr(i32 %1, i32 %2)
%13 = call i32 @flash_write(i8* %5, i32 %0, i32 4)
ret void
}