#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 */
scalar_t__ floor(int);
int log10(int);
double pow(int, int);
int /*<<< orphan*/ printf(char *, double);
scalar_t__ sqrt(int);
int Problem005(void) {
  int k = 20;
  double N = 1.0;
  int i = 0;
  int check = 1;
  int limit = (int)sqrt(k);
  int p[] = {2, 3, 5, 7, 11, 13, 17, 19, 20};
  int a[] = {1, 1, 1, 1, 1, 1, 1, 1, 0};
  for (i = 0; p[i] < k; i++) {
    if (check) {
      if (p[i] <= limit) {
        a[i] = (int)floor(log10(k) / log10(p[i]));
      } else {
        check = 0;
      }
    }
    N *= pow(p[i], a[i]);
  }
  printf("%30.0f", N);
  return 0;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x14,-0x4(%rbp)
movsd  0xe86(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <sqrt@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe6d(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xe88(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
cmp    -0x4(%rbp),%eax
jge    1264 <Problem005+0x104>
cmpl   $0x0,-0x18(%rbp)
je     1237 <Problem005+0xd7>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
cmp    -0x1c(%rbp),%eax
jg     122b <Problem005+0xcb>
mov    -0x4(%rbp),%edi
call   1060 <log10@plt>
mov    %eax,-0x74(%rbp)
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
call   1060 <log10@plt>
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1080 <floor@plt>
mov    %eax,%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x70(%rbp,%rax,4)
jmp    1232 <Problem005+0xd2>
movl   $0x0,-0x18(%rbp)
jmp    1237 <Problem005+0xd7>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
movslq -0x14(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%esi
call   1050 <pow@plt>
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c9 <Problem005+0x69>
movsd  -0x10(%rbp),%xmm0
lea    0xdf4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    $0x14,%edi
call   1060 <sqrt@plt>
mov    %rax,%r14
mov    0xef1(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    $0x1,%r15d
movsd  0xe67(%rip),%xmm0
mov    $0x2,%ebp
xor    %ebx,%ebx
lea    0xe69(%rip),%r12
jmp    11db <Problem005+0x8b>
nopl   0x0(%rax)
mov    0x10(%rsp,%rbx,4),%esi
xor    %r15d,%r15d
mov    %ebp,%edi
call   1040 <pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
mov    0x4(%r12,%rbx,4),%ebp
add    $0x1,%rbx
cmp    $0x8,%rbx
je     121d <Problem005+0xcd>
movsd  %xmm0,0x8(%rsp)
test   %r15d,%r15d
je     11b0 <Problem005+0x60>
cmp    %r14d,%ebp
jg     11b0 <Problem005+0x60>
mov    $0x14,%edi
call   1050 <log10@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1050 <log10@plt>
mov    %eax,%ecx
mov    %r15d,%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1070 <floor@plt>
mov    %rax,%rsi
mov    %esi,0x10(%rsp,%rbx,4)
mov    $0x1,%r15d
jmp    11b7 <Problem005+0x67>
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.Problem005.p = [9 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19, i32 20]
@__const.Problem005.a = [9 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 0]
@.str = [7 x i8] c"%30.0f\00"
define i32 @Problem005() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [9 x i32]
%7 = alloca [9 x i32]
store i32 20, i32* %1
store double 1.000000e+00, double* %2
store i32 0, i32* %3
store i32 1, i32* %4
%8 = load i32, i32* %1
%9 = call i64 @sqrt(i32 %8)
%10 = trunc i64 %9 to i32
store i32 %10, i32* %5
%11 = bitcast [9 x i32]* %6 to i8*
%12 = bitcast [9 x i32]* %7 to i8*
store i32 0, i32* %3
br label %13
13: ; preds = %58, %0
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = load i32, i32* %1
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %61
20: ; preds = %13
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %46
23: ; preds = %20
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = load i32, i32* %5
%29 = icmp sle i32 %27, %28
br i1 %29, label %30, label %44
30: ; preds = %23
%31 = load i32, i32* %1
%32 = call i32 @log10(i32 %31)
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = call i32 @log10(i32 %36)
%38 = sdiv i32 %32, %37
%39 = call i64 @floor(i32 %38)
%40 = trunc i64 %39 to i32
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [9 x i32], [9 x i32]* %7, i64 0, i64 %42
store i32 %40, i32* %43
br label %45
44: ; preds = %23
store i32 0, i32* %4
br label %45
45: ; preds = %44, %30
br label %46
46: ; preds = %45, %20
%47 = load i32, i32* %3
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = load i32, i32* %3
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [9 x i32], [9 x i32]* %7, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = call double @pow(i32 %50, i32 %54)
%56 = load double, double* %2
%57 = fmul double %56, %55
store double %57, double* %2
br label %58
58: ; preds = %46
%59 = load i32, i32* %3
%60 = add nsw i32 %59, 1
store i32 %60, i32* %3
br label %13
61: ; preds = %13
%62 = load double, double* %2
%63 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %62)
ret i32 0
}

LLVM IR (-O2):
@__const.Problem005.p = [9 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19, i32 20]
@__const.Problem005.a = [9 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 0]
@.str = [7 x i8] c"%30.0f\00"
define i32 @Problem005() {
%1 = alloca [9 x i32]
%2 = tail call i64 @sqrt(i32 20)
%3 = trunc i64 %2 to i32
%4 = bitcast [9 x i32]* %1 to i8*
br label %5
5: ; preds = %0, %23
%6 = phi i64 [ 0, %0 ], [ %28, %23 ]
%7 = phi i32 [ 2, %0 ], [ %30, %23 ]
%8 = phi double [ 1.000000e+00, %0 ], [ %27, %23 ]
%9 = phi i32 [ 1, %0 ], [ %25, %23 ]
%10 = icmp eq i32 %9, 0
%11 = icmp sgt i32 %7, %3
%12 = select i1 %10, i1 true, i1 %11
br i1 %12, label %13, label %16
13: ; preds = %5
%14 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 %6
%15 = load i32, i32* %14
br label %23
16: ; preds = %5
%17 = tail call i32 @log10(i32 20)
%18 = tail call i32 @log10(i32 %7)
%19 = sdiv i32 %17, %18
%20 = tail call i64 @floor(i32 %19)
%21 = trunc i64 %20 to i32
%22 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 %6
store i32 %21, i32* %22
br label %23
23: ; preds = %13, %16
%24 = phi i32 [ %21, %16 ], [ %15, %13 ]
%25 = phi i32 [ 1, %16 ], [ 0, %13 ]
%26 = tail call double @pow(i32 %7, i32 %24)
%27 = fmul double %8, %26
%28 = add nuw nsw i64 %6, 1
%29 = getelementptr inbounds [9 x i32], [9 x i32]* @__const.Problem005.p, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = icmp eq i64 %28, 8
br i1 %31, label %32, label %5
32: ; preds = %23
%33 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %27)
ret i32 0
}