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

/* Variables and functions */
int /*<<< orphan*/ load_frequency(int /*<<< orphan*/ *, int, int, double);
int /*<<< orphan*/ one_shot_b(int /*<<< orphan*/ *);
int set_freq(int freq_in, FILE *ics660[]) {
  int pci_ind;
  int pci_min = 0;
  int pci_max = 0;
  int channel, chip;
  double freq;
  double state_time = 5.e-6;
  int status = 0;
  freq = (double)freq_in * 1000.;
  for (pci_ind = pci_max; pci_ind >= pci_min; pci_ind--) {
    for (chip = 1; chip <= 4; chip++) {
      for (channel = 1; channel <= 4; channel++) {
        load_frequency(ics660[pci_ind], chip, channel, freq);
      }
    }
  }
  pci_ind = 0;
  one_shot_b(ics660[pci_ind]);
}


x86 assembly (clang, -O0):
<set_freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jl     11eb <set_freq+0xcb>
movl   $0x1,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jg     11d8 <set_freq+0xb8>
movl   $0x1,-0x20(%rbp)
cmpl   $0x4,-0x20(%rbp)
jg     11c5 <set_freq+0xa5>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
movsd  -0x30(%rbp),%xmm0
call   1030 <load_frequency@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1191 <set_freq+0x71>
jmp    11ca <set_freq+0xaa>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1180 <set_freq+0x60>
jmp    11dd <set_freq+0xbd>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    116d <set_freq+0x4d>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <one_shot_b@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_freq>:
push   %rbx
sub    $0x10,%rsp
cvtsi2sd %edi,%xmm0
mov    %rsi,%rbx
mulsd  0xecc(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    (%rsi),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x1,%esi
mov    $0x3,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x2,%esi
mov    $0x2,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x2,%esi
mov    $0x4,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x3,%esi
mov    $0x3,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x3,%esi
mov    $0x4,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x4,%esi
mov    $0x2,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x4,%esi
mov    $0x3,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
mov    $0x4,%esi
mov    $0x4,%edx
movsd  0x8(%rsp),%xmm0
call   1030 <load_frequency@plt>
mov    (%rbx),%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <one_shot_b@plt>

LLVM IR (-O0):
define i32 @set_freq(i32 %0, i32** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca i32
store i32 %0, i32* %4
store i32** %1, i32*** %5
store i32 0, i32* %7
store i32 0, i32* %8
store double 5.000000e-06, double* %12
store i32 0, i32* %13
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 1.000000e+03
store double %16, double* %11
%17 = load i32, i32* %8
store i32 %17, i32* %6
br label %18
18: ; preds = %48, %2
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = icmp sge i32 %19, %20
br i1 %21, label %22, label %51
22: ; preds = %18
store i32 1, i32* %10
br label %23
23: ; preds = %44, %22
%24 = load i32, i32* %10
%25 = icmp sle i32 %24, 4
br i1 %25, label %26, label %47
26: ; preds = %23
store i32 1, i32* %9
br label %27
27: ; preds = %40, %26
%28 = load i32, i32* %9
%29 = icmp sle i32 %28, 4
br i1 %29, label %30, label %43
30: ; preds = %27
%31 = load i32**, i32*** %5
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32*, i32** %31, i64 %33
%35 = load i32*, i32** %34
%36 = load i32, i32* %10
%37 = load i32, i32* %9
%38 = load double, double* %11
%39 = call i32 @load_frequency(i32* %35, i32 %36, i32 %37, double %38)
br label %40
40: ; preds = %30
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
br label %27
43: ; preds = %27
br label %44
44: ; preds = %43
%45 = load i32, i32* %10
%46 = add nsw i32 %45, 1
store i32 %46, i32* %10
br label %23
47: ; preds = %23
br label %48
48: ; preds = %47
%49 = load i32, i32* %6
%50 = add nsw i32 %49, -1
store i32 %50, i32* %6
br label %18
51: ; preds = %18
store i32 0, i32* %6
%52 = load i32**, i32*** %5
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i32*, i32** %52, i64 %54
%56 = load i32*, i32** %55
%57 = call i32 @one_shot_b(i32* %56)
%58 = load i32, i32* %3
ret i32 %58
}

LLVM IR (-O2):
define i32 @set_freq(i32 %0, i32** nocapture %1) {
%3 = sitofp i32 %0 to double
%4 = fmul double %3, 1.000000e+03
%5 = load i32*, i32** %1
%6 = tail call i32 @load_frequency(i32* %5, i32 1, i32 1, double %4)
%7 = load i32*, i32** %1
%8 = tail call i32 @load_frequency(i32* %7, i32 1, i32 2, double %4)
%9 = load i32*, i32** %1
%10 = tail call i32 @load_frequency(i32* %9, i32 1, i32 3, double %4)
%11 = load i32*, i32** %1
%12 = tail call i32 @load_frequency(i32* %11, i32 1, i32 4, double %4)
%13 = load i32*, i32** %1
%14 = tail call i32 @load_frequency(i32* %13, i32 2, i32 1, double %4)
%15 = load i32*, i32** %1
%16 = tail call i32 @load_frequency(i32* %15, i32 2, i32 2, double %4)
%17 = load i32*, i32** %1
%18 = tail call i32 @load_frequency(i32* %17, i32 2, i32 3, double %4)
%19 = load i32*, i32** %1
%20 = tail call i32 @load_frequency(i32* %19, i32 2, i32 4, double %4)
%21 = load i32*, i32** %1
%22 = tail call i32 @load_frequency(i32* %21, i32 3, i32 1, double %4)
%23 = load i32*, i32** %1
%24 = tail call i32 @load_frequency(i32* %23, i32 3, i32 2, double %4)
%25 = load i32*, i32** %1
%26 = tail call i32 @load_frequency(i32* %25, i32 3, i32 3, double %4)
%27 = load i32*, i32** %1
%28 = tail call i32 @load_frequency(i32* %27, i32 3, i32 4, double %4)
%29 = load i32*, i32** %1
%30 = tail call i32 @load_frequency(i32* %29, i32 4, i32 1, double %4)
%31 = load i32*, i32** %1
%32 = tail call i32 @load_frequency(i32* %31, i32 4, i32 2, double %4)
%33 = load i32*, i32** %1
%34 = tail call i32 @load_frequency(i32* %33, i32 4, i32 3, double %4)
%35 = load i32*, i32** %1
%36 = tail call i32 @load_frequency(i32* %35, i32 4, i32 4, double %4)
%37 = load i32*, i32** %1
%38 = tail call i32 @one_shot_b(i32* %37)
ret i32 undef
}