#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*/ vbuf;

/* Variables and functions */
int /*<<< orphan*/ iw_calcu_freq_value(char *, int, double);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
void iw_calcu_freq(char *buffer, int buflen, double freq, int *channel,
                   int freq_flags) {
  char vbuf[16];
  iw_calcu_freq_value(vbuf, sizeof(vbuf), freq);
  if (freq < 1e3)
    snprintf(buffer, buflen, "%s", vbuf);
  else {
    if (channel < 0)
      snprintf(buffer, buflen, "%s", vbuf);
  }
}


x86 assembly (clang, -O0):
<iw_calcu_freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
lea    -0x40(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
mov    $0x10,%esi
call   1040 <iw_calcu_freq_value@plt>
movsd  0xeaa(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    117d <iw_calcu_freq+0x5d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rcx
lea    0xe95(%rip),%rdx
call   1030 <snprintf@plt>
jmp    11a4 <iw_calcu_freq+0x84>
cmpq   $0x0,-0x20(%rbp)
jae    119f <iw_calcu_freq+0x7f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rcx
lea    0xe6e(%rip),%rdx
call   1030 <snprintf@plt>
jmp    11a4 <iw_calcu_freq+0x84>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iw_calcu_freq>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x10(%rsp),%rdi
mov    $0x10,%esi
call   1040 <iw_calcu_freq_value@plt>
movsd  0xeb8(%rip),%xmm0
ucomisd 0x8(%rsp),%xmm0
jbe    1166 <iw_calcu_freq+0x46>
lea    0xeb1(%rip),%rdx
lea    0x10(%rsp),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <snprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @iw_calcu_freq(i8* %0, i32 %1, double %2, i32* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca double
%9 = alloca i32*
%10 = alloca i32
%11 = alloca [16 x i8]
store i8* %0, i8** %6
store i32 %1, i32* %7
store double %2, double* %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%13 = load double, double* %8
%14 = call i32 @iw_calcu_freq_value(i8* %12, i32 16, double %13)
%15 = load double, double* %8
%16 = fcmp olt double %15, 1.000000e+03
br i1 %16, label %17, label %22
17: ; preds = %5
%18 = load i8*, i8** %6
%19 = load i32, i32* %7
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%21 = call i32 @snprintf(i8* %18, i32 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %20)
br label %31
22: ; preds = %5
%23 = load i32*, i32** %9
%24 = icmp ult i32* %23, null
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i8*, i8** %6
%27 = load i32, i32* %7
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%29 = call i32 @snprintf(i8* %26, i32 %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %25, %22
br label %31
31: ; preds = %30, %17
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @iw_calcu_freq(i8* %0, i32 %1, double %2, i32* nocapture readnone %3, i32 %4) {
%6 = alloca [16 x i8]
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%8 = call i32 @iw_calcu_freq_value(i8* %7, i32 16, double %2)
%9 = fcmp olt double %2, 1.000000e+03
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %12
12: ; preds = %5, %10
ret void
}