#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 */
int fact_(int *);
int /*<<< orphan*/ printf(char *, float, float, ...);
int /*<<< orphan*/ pythagoras_(float *, float *, float *);
int main() {
  int nn = 4;
  printf("Factorial of %d is: %d\n", nn, fact_(&nn));
  float cc;
  float aa = 30.0;
  float bb = 40.0;
  pythagoras_(&aa, &bb, &cc);
  printf("Hypotenuse if sides %f, %f is: %f\n", aa, bb, cc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <fact_@plt>
movss  -0x18(%rbp),%xmm0
cvtsi2ss %eax,%xmm1
lea    0xe9f(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xe8c(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe7b(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <pythagoras_@plt>
movss  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe6b(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x4,0x14(%rsp)
lea    0x14(%rsp),%rdi
call   1050 <fact_@plt>
cvtsi2ss %eax,%xmm1
lea    0xeb3(%rip),%rdi
movss  0xea7(%rip),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
movl   $0x41f00000,0xc(%rsp)
41
movl   $0x42200000,0x8(%rsp)
42
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1030 <pythagoras_@plt>
movss  0xc(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe7b(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Factorial of %d is: %d\0A\00"
@.str.1 = [35 x i8] c"Hypotenuse if sides %f, %f is: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store i32 4, i32* %2
%6 = load i32, i32* %2
%7 = sitofp i32 %6 to float
%8 = call i32 @fact_(i32* %2)
%9 = sitofp i32 %8 to float
%10 = call i32 (i8*, float, float, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), float %7, float %9)
store float 3.000000e+01, float* %4
store float 4.000000e+01, float* %5
%11 = call i32 @pythagoras_(float* %4, float* %5, float* %3)
%12 = load float, float* %4
%13 = load float, float* %5
%14 = load float, float* %3
%15 = fpext float %14 to double
%16 = call i32 (i8*, float, float, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), float %12, float %13, double %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Factorial of %d is: %d\0A\00"
@.str.1 = [35 x i8] c"Hypotenuse if sides %f, %f is: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = bitcast i32* %1 to i8*
store i32 4, i32* %1
%6 = call i32 @fact_(i32* %1)
%7 = sitofp i32 %6 to float
%8 = call i32 (i8*, float, float, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), float 4.000000e+00, float %7)
%9 = bitcast float* %2 to i8*
%10 = bitcast float* %3 to i8*
store float 3.000000e+01, float* %3
%11 = bitcast float* %4 to i8*
store float 4.000000e+01, float* %4
%12 = call i32 @pythagoras_(float* %3, float* %4, float* %2)
%13 = load float, float* %3
%14 = load float, float* %4
%15 = load float, float* %2
%16 = fpext float %15 to double
%17 = call i32 (i8*, float, float, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), float %13, float %14, double %16)
ret i32 0
}