#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 getCarrierFrequencyDeviation(float *,
                                 int (*)(unsigned char *const, unsigned int,
                                         void *const),
                                 void *const);
int setCarrierFrequencyDeviation(float const *const,
                                 int (*)(unsigned char *const, unsigned int,
                                         void *const),
                                 void *const);
int setCarrierFrequencyDeviationChecked(
    const float *const freq,
    int (*spiTransfer)(unsigned char *const, unsigned int,
                       void *const customData),
    void *const customData) {
  int res = setCarrierFrequencyDeviation(freq, spiTransfer, customData);
  if (res < 0) {
    return res;
  }
  float freqNew;
  res = getCarrierFrequencyDeviation(&freqNew, spiTransfer, customData);
  if (res < 0) {
    return res;
  }
  if (freqNew != *freq) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<setCarrierFrequencyDeviationChecked>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <setCarrierFrequencyDeviation@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    115d <setCarrierFrequencyDeviationChecked+0x3d>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b6 <setCarrierFrequencyDeviationChecked+0x96>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
call   1040 <getCarrierFrequencyDeviation@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1186 <setCarrierFrequencyDeviationChecked+0x66>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b6 <setCarrierFrequencyDeviationChecked+0x96>
movss  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomiss (%rax),%xmm0
jne    11a3 <setCarrierFrequencyDeviationChecked+0x83>
jp     11a3 <setCarrierFrequencyDeviationChecked+0x83>
jmp    11af <setCarrierFrequencyDeviationChecked+0x8f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b6 <setCarrierFrequencyDeviationChecked+0x96>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setCarrierFrequencyDeviationChecked>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <setCarrierFrequencyDeviation@plt>
test   %eax,%eax
js     115f <setCarrierFrequencyDeviationChecked+0x3f>
lea    0xc(%rsp),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1040 <getCarrierFrequencyDeviation@plt>
test   %eax,%eax
js     115f <setCarrierFrequencyDeviationChecked+0x3f>
movss  (%r14),%xmm0
cmpneqss 0xc(%rsp),%xmm0
movd   %xmm0,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @setCarrierFrequencyDeviationChecked(float* %0, i32 (i8*, i32, i8*)* %1, i8* %2) {
%4 = alloca i32
%5 = alloca float*
%6 = alloca i32 (i8*, i32, i8*)*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca float
store float* %0, float** %5
store i32 (i8*, i32, i8*)* %1, i32 (i8*, i32, i8*)** %6
store i8* %2, i8** %7
%10 = load float*, float** %5
%11 = load i32 (i8*, i32, i8*)*, i32 (i8*, i32, i8*)** %6
%12 = load i8*, i8** %7
%13 = call i32 @setCarrierFrequencyDeviation(float* %10, i32 (i8*, i32, i8*)* %11, i8* %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %3
%17 = load i32, i32* %8
store i32 %17, i32* %4
br label %33
18: ; preds = %3
%19 = load i32 (i8*, i32, i8*)*, i32 (i8*, i32, i8*)** %6
%20 = load i8*, i8** %7
%21 = call i32 @getCarrierFrequencyDeviation(float* %9, i32 (i8*, i32, i8*)* %19, i8* %20)
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = load i32, i32* %8
store i32 %25, i32* %4
br label %33
26: ; preds = %18
%27 = load float, float* %9
%28 = load float*, float** %5
%29 = load float, float* %28
%30 = fcmp une float %27, %29
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 -1, i32* %4
br label %33
32: ; preds = %26
store i32 0, i32* %4
br label %33
33: ; preds = %32, %31, %24, %16
%34 = load i32, i32* %4
ret i32 %34
}

LLVM IR (-O2):
define i32 @setCarrierFrequencyDeviationChecked(float* %0, i32 (i8*, i32, i8*)* %1, i8* %2) {
%4 = alloca float
%5 = tail call i32 @setCarrierFrequencyDeviation(float* %0, i32 (i8*, i32, i8*)* %1, i8* %2)
%6 = icmp slt i32 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %3
%8 = bitcast float* %4 to i8*
%9 = call i32 @getCarrierFrequencyDeviation(float* %4, i32 (i8*, i32, i8*)* %1, i8* %2)
%10 = icmp slt i32 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %7
%12 = load float, float* %4
%13 = load float, float* %0
%14 = fcmp une float %12, %13
%15 = sext i1 %14 to i32
br label %16
16: ; preds = %11, %7
%17 = phi i32 [ %9, %7 ], [ %15, %11 ]
br label %18
18: ; preds = %3, %16
%19 = phi i32 [ %17, %16 ], [ %5, %3 ]
ret i32 %19
}