#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*/ uint16_t;
struct bladerf {
  int dummy;
};

/* Variables and functions */
int nios_8x16_write(struct bladerf *, int, int, int /*<<< orphan*/);
int nios_vctcxo_trim_dac_write(struct bladerf *dev, uint16_t value) {
  int status;
  status = nios_8x16_write(dev, 0x00, 0x28, 0);
  if (status == 0) {
    status = nios_8x16_write(dev, 0x00, 0x08, value);
    do {
      do {
      } while (0);
    } while (0);
  }
  return status;
}


x86 assembly (clang, -O0):
<nios_vctcxo_trim_dac_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
xor    %ecx,%ecx
mov    $0x28,%edx
mov    %ecx,%esi
call   1030 <nios_8x16_write@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1168 <nios_vctcxo_trim_dac_write+0x58>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <nios_8x16_write@plt>
mov    %eax,-0x10(%rbp)
jmp    1159 <nios_vctcxo_trim_dac_write+0x49>
jmp    115e <nios_vctcxo_trim_dac_write+0x4e>
jmp    1163 <nios_vctcxo_trim_dac_write+0x53>
jmp    1168 <nios_vctcxo_trim_dac_write+0x58>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nios_vctcxo_trim_dac_write>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x28,%edx
xor    %ecx,%ecx
call   1030 <nios_8x16_write@plt>
test   %eax,%eax
je     1131 <nios_vctcxo_trim_dac_write+0x21>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x8,%edx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <nios_8x16_write@plt>

LLVM IR (-O0):
%struct.bladerf = type { i32 }
define i32 @nios_vctcxo_trim_dac_write(%struct.bladerf* %0, i32 %1) {
%3 = alloca %struct.bladerf*
%4 = alloca i32
%5 = alloca i32
store %struct.bladerf* %0, %struct.bladerf** %3
store i32 %1, i32* %4
%6 = load %struct.bladerf*, %struct.bladerf** %3
%7 = call i32 @nios_8x16_write(%struct.bladerf* %6, i32 0, i32 40, i32 0)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %2
%11 = load %struct.bladerf*, %struct.bladerf** %3
%12 = load i32, i32* %4
%13 = call i32 @nios_8x16_write(%struct.bladerf* %11, i32 0, i32 8, i32 %12)
store i32 %13, i32* %5
br label %14
14: ; preds = %10
br label %15
15: ; preds = %14
br label %16
16: ; preds = %15
br label %17
17: ; preds = %16
br label %18
18: ; preds = %17, %2
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
%struct.bladerf = type { i32 }
define i32 @nios_vctcxo_trim_dac_write(%struct.bladerf* %0, i32 %1) {
%3 = tail call i32 @nios_8x16_write(%struct.bladerf* %0, i32 0, i32 40, i32 0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @nios_8x16_write(%struct.bladerf* %0, i32 0, i32 8, i32 %1)
br label %7
7: ; preds = %5, %2
%8 = phi i32 [ %6, %5 ], [ %3, %2 ]
ret i32 %8
}