#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 */
double atof(char *);
int atoi(char *);
int pow(double, double);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int i;
  double power = 1;
  double exp = 1.0 / 24.0;
  if (argc < 3) {
    printf("usage: %s <scale factor> <q1> .. <q22> <rf1> <rf2>\n", argv[0]);
    return 1;
  }
  for (i = 2; i < argc; i++) {
    power *= atof(argv[i]);
  }
  printf("%0.2f", 3600 * atoi(argv[1]) / pow(power, exp));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xeaa(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe95(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    119b <main+0x5b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    121b <main+0xdb>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d7 <main+0x97>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <atof@plt>
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a2 <main+0x62>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
imul   $0xe10,%eax,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
jge    1169 <main+0x29>
mov    (%r14),%rsi
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
jmp    11dd <main+0x9d>
mov    %edi,%r15d
movsd  0xe8c(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x2,%ebx
nop
mov    (%r14,%rbx,8),%rdi
call   1030 <atof@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1180 <main+0x40>
mov    0x8(%r14),%rdi
call   1060 <atoi@plt>
imul   $0xe10,%eax,%ebx
movsd  0xe4f(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1050 <pow@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
lea    0xe72(%rip),%rdi
xor    %ebx,%ebx
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [52 x i8] c"usage: %s <scale factor> <q1> .. <q22> <rf1> <rf2>\0A\00"
@.str.1 = [6 x i8] c"%0.2f\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 1.000000e+00, double* %7
store double 0x3FA5555555555555, double* %8
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 1, i32* %3
br label %44
16: ; preds = %2
store i32 2, i32* %6
br label %17
17: ; preds = %30, %16
%18 = load i32, i32* %6
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %33
21: ; preds = %17
%22 = load i8**, i8*** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call double @atof(i8* %26)
%28 = load double, double* %7
%29 = fmul double %28, %27
store double %29, double* %7
br label %30
30: ; preds = %21
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %17
33: ; preds = %17
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
%38 = mul nsw i32 3600, %37
%39 = load double, double* %7
%40 = load double, double* %8
%41 = call i32 @pow(double %39, double %40)
%42 = sdiv i32 %38, %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %42)
store i32 0, i32* %3
br label %44
44: ; preds = %33, %11
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@.str = [52 x i8] c"usage: %s <scale factor> <q1> .. <q22> <rf1> <rf2>\0A\00"
@.str.1 = [6 x i8] c"%0.2f\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %26
9: ; preds = %4, %9
%10 = phi i64 [ 2, %4 ], [ %16, %9 ]
%11 = phi double [ 1.000000e+00, %4 ], [ %15, %9 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %10
%13 = load i8*, i8** %12
%14 = tail call double @atof(i8* %13)
%15 = fmul double %11, %14
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, %5
br i1 %17, label %18, label %9
18: ; preds = %9
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
%22 = mul nsw i32 %21, 3600
%23 = tail call i32 @pow(double %15, double 0x3FA5555555555555)
%24 = sdiv i32 %22, %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %18, %6
%27 = phi i32 [ 1, %6 ], [ 0, %18 ]
ret i32 %27
}