#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 */
size_t maximum_double(double *, int);
void scale_frequencies(double frequencies[26]) {
  register int i;
  double scaleFactor;
  scaleFactor = (double)(12.702 / frequencies[maximum_double(frequencies, 26)]);
  for (i = 0; i < 26; i++)
    frequencies[i] *= scaleFactor;
}


x86 assembly (clang, -O0):
<scale_frequencies>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1a,%esi
call   1030 <maximum_double@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
movsd  0xebf(%rip),%xmm0
divsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1a,-0xc(%rbp)
jge    1181 <scale_frequencies+0x71>
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <scale_frequencies+0x42>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_frequencies>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1a,%esi
call   1030 <maximum_double@plt>
movsd  0xeda(%rip),%xmm0
divsd  (%rbx,%rax,8),%xmm0
unpcklpd %xmm0,%xmm0
movupd (%rbx),%xmm1
movupd 0x10(%rbx),%xmm2
movupd 0x20(%rbx),%xmm3
movupd 0x30(%rbx),%xmm4
mulpd  %xmm0,%xmm1
movupd %xmm1,(%rbx)
mulpd  %xmm0,%xmm2
movupd %xmm2,0x10(%rbx)
mulpd  %xmm0,%xmm3
movupd %xmm3,0x20(%rbx)
mulpd  %xmm0,%xmm4
movupd %xmm4,0x30(%rbx)
movupd 0x40(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0x40(%rbx)
movupd 0x50(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0x50(%rbx)
movupd 0x60(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0x60(%rbx)
movupd 0x70(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0x70(%rbx)
movupd 0x80(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0x80(%rbx)
movupd 0x90(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0x90(%rbx)
movupd 0xa0(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0xa0(%rbx)
movupd 0xb0(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0xb0(%rbx)
movupd 0xc0(%rbx),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0xc0(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @scale_frequencies(double* %0) {
%2 = alloca double*
%3 = alloca i32
%4 = alloca double
store double* %0, double** %2
%5 = load double*, double** %2
%6 = load double*, double** %2
%7 = call i64 @maximum_double(double* %6, i32 26)
%8 = getelementptr inbounds double, double* %5, i64 %7
%9 = load double, double* %8
%10 = fdiv double 1.270200e+01, %9
store double %10, double* %4
store i32 0, i32* %3
br label %11
11: ; preds = %22, %1
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 26
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = load double, double* %4
%16 = load double*, double** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
%21 = fmul double %20, %15
store double %21, double* %19
br label %22
22: ; preds = %14
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %11
25: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @scale_frequencies(double* %0) {
%2 = tail call i64 @maximum_double(double* %0, i32 26)
%3 = getelementptr inbounds double, double* %0, i64 %2
%4 = load double, double* %3
%5 = fdiv double 1.270200e+01, %4
%6 = bitcast double* %0 to <2 x double>*
%7 = load <2 x double>, <2 x double>* %6
%8 = insertelement <2 x double> poison, double %5, i64 0
%9 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer
%10 = fmul <2 x double> %9, %7
%11 = bitcast double* %0 to <2 x double>*
store <2 x double> %10, <2 x double>* %11
%12 = getelementptr inbounds double, double* %0, i64 2
%13 = bitcast double* %12 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = fmul <2 x double> %9, %14
%16 = bitcast double* %12 to <2 x double>*
store <2 x double> %15, <2 x double>* %16
%17 = getelementptr inbounds double, double* %0, i64 4
%18 = bitcast double* %17 to <2 x double>*
%19 = load <2 x double>, <2 x double>* %18
%20 = fmul <2 x double> %9, %19
%21 = bitcast double* %17 to <2 x double>*
store <2 x double> %20, <2 x double>* %21
%22 = getelementptr inbounds double, double* %0, i64 6
%23 = bitcast double* %22 to <2 x double>*
%24 = load <2 x double>, <2 x double>* %23
%25 = fmul <2 x double> %9, %24
%26 = bitcast double* %22 to <2 x double>*
store <2 x double> %25, <2 x double>* %26
%27 = getelementptr inbounds double, double* %0, i64 8
%28 = bitcast double* %27 to <2 x double>*
%29 = load <2 x double>, <2 x double>* %28
%30 = fmul <2 x double> %9, %29
%31 = bitcast double* %27 to <2 x double>*
store <2 x double> %30, <2 x double>* %31
%32 = getelementptr inbounds double, double* %0, i64 10
%33 = bitcast double* %32 to <2 x double>*
%34 = load <2 x double>, <2 x double>* %33
%35 = fmul <2 x double> %9, %34
%36 = bitcast double* %32 to <2 x double>*
store <2 x double> %35, <2 x double>* %36
%37 = getelementptr inbounds double, double* %0, i64 12
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = fmul <2 x double> %9, %39
%41 = bitcast double* %37 to <2 x double>*
store <2 x double> %40, <2 x double>* %41
%42 = getelementptr inbounds double, double* %0, i64 14
%43 = bitcast double* %42 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = fmul <2 x double> %9, %44
%46 = bitcast double* %42 to <2 x double>*
store <2 x double> %45, <2 x double>* %46
%47 = getelementptr inbounds double, double* %0, i64 16
%48 = bitcast double* %47 to <2 x double>*
%49 = load <2 x double>, <2 x double>* %48
%50 = fmul <2 x double> %9, %49
%51 = bitcast double* %47 to <2 x double>*
store <2 x double> %50, <2 x double>* %51
%52 = getelementptr inbounds double, double* %0, i64 18
%53 = bitcast double* %52 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = fmul <2 x double> %9, %54
%56 = bitcast double* %52 to <2 x double>*
store <2 x double> %55, <2 x double>* %56
%57 = getelementptr inbounds double, double* %0, i64 20
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = fmul <2 x double> %9, %59
%61 = bitcast double* %57 to <2 x double>*
store <2 x double> %60, <2 x double>* %61
%62 = getelementptr inbounds double, double* %0, i64 22
%63 = bitcast double* %62 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = fmul <2 x double> %9, %64
%66 = bitcast double* %62 to <2 x double>*
store <2 x double> %65, <2 x double>* %66
%67 = getelementptr inbounds double, double* %0, i64 24
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = fmul <2 x double> %9, %69
%71 = bitcast double* %67 to <2 x double>*
store <2 x double> %70, <2 x double>* %71
ret void
}