#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 scalar_t__ clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
scalar_t__ clock();
int num_strong(int);
int num_weak(int);
int /*<<< orphan*/ printf(char *, int, int, double);
void get_percent(int n) {
  clock_t sec;
  sec = clock();
  int witnesses = n - 3;
  int strong = num_strong(n);
  int weak = num_weak(n);
  printf("strong =  %d\nweak =  %d\ncorrectness = true\nans =  %f\n", strong,
         weak, (double)(clock() - sec) * 1000 / CLOCKS_PER_SEC);
}


x86 assembly (clang, -O0):
<get_percent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <num_strong@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <num_weak@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
sub    -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm0
movsd  0xe61(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2e3e(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_percent>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1060 <num_strong@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1050 <num_weak@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <clock@plt>
sub    %r14,%rax
cvtsi2sd %rax,%xmm0
mulsd  0xe87(%rip),%xmm0
mov    0x2e68(%rip),%rax
divsd  (%rax),%xmm0
lea    0xe7d(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"strong = %d\0Aweak = %d\0Acorrectness = true\0Aans = %f\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define void @get_percent(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = call i64 (...) @clock()
store i64 %7, i64* %3
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 3
store i32 %9, i32* %4
%10 = load i32, i32* %2
%11 = call i32 @num_strong(i32 %10)
store i32 %11, i32* %5
%12 = load i32, i32* %2
%13 = call i32 @num_weak(i32 %12)
store i32 %13, i32* %6
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = call i64 (...) @clock()
%17 = load i64, i64* %3
%18 = sub nsw i64 %16, %17
%19 = sitofp i64 %18 to double
%20 = fmul double %19, 1.000000e+03
%21 = load double, double* @CLOCKS_PER_SEC
%22 = fdiv double %20, %21
%23 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15, double %22)
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"strong = %d\0Aweak = %d\0Acorrectness = true\0Aans = %f\0A\00"
@CLOCKS_PER_SEC = global double 0.000000e+00
define void @get_percent(i32 %0) {
%2 = tail call i64 (...) @clock()
%3 = tail call i32 @num_strong(i32 %0)
%4 = tail call i32 @num_weak(i32 %0)
%5 = tail call i64 (...) @clock()
%6 = sub nsw i64 %5, %2
%7 = sitofp i64 %6 to double
%8 = fmul double %7, 1.000000e+03
%9 = load double, double* @CLOCKS_PER_SEC
%10 = fdiv double %8, %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4, double %10)
ret void
}