#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 /*<<< orphan*/ ceil(double);
int /*<<< orphan*/ cos(double);
int /*<<< orphan*/ floor(double);
int /*<<< orphan*/ pow(double, int);
int /*<<< orphan*/ printf(char *, double, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ sqrt(double);
int main(int argc, char *argv[]) {
  double x;
  int power;
  puts("Enter a number: ");
  scanf("%lf", &x);
  printf("\n\nOriginal value: %lf", x);
  printf("\nCeil: %lf", ceil(x));
  printf("\nFloor: %lf", floor(x));
  if (x >= 0)
    printf("\nSquare root: %lf", sqrt(x));
  else
    puts("\nNegative number");
  printf("\nCosine: %lf\n", cos(x));
  puts("Enter a whole number between 2 and 10: ");
  scanf("%d", &power);
  printf("\n%lf to the %d power is %lf\n", x, power, pow(x, power));
  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)
lea    0xe63(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7a(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   1040 <ceil@plt>
cvtsi2sd %eax,%xmm0
lea    0xe4b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   10a0 <floor@plt>
cvtsi2sd %eax,%xmm0
lea    0xe3a(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1232 <main+0xb2>
movsd  -0x18(%rbp),%xmm0
call   1090 <sqrt@plt>
cvtsi2sd %eax,%xmm0
lea    0xe18(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    123e <main+0xbe>
lea    0xe17(%rip),%rdi
call   1030 <puts@plt>
movsd  -0x18(%rbp),%xmm0
call   1070 <cos@plt>
cvtsi2sd %eax,%xmm0
lea    0xe0e(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe0e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe2a(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
call   1080 <pow@plt>
movsd  -0x28(%rbp),%xmm0
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xdf4(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xe74(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8b(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movsd  0x8(%rsp),%xmm0
lea    0xe60(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1040 <ceil@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe56(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   10a0 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe41(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    1216 <main+0x96>
lea    0xe41(%rip),%rdi
call   1030 <puts@plt>
jmp    1230 <main+0xb0>
call   1090 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe15(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm0
call   1070 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xe18(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe18(%rip),%rdi
call   1030 <puts@plt>
lea    0xe34(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    0x14(%rsp),%ebx
mov    %ebx,%edi
call   1080 <pow@plt>
lea    0xe0d(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    %ebx,%esi
mov    %eax,%edx
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [22 x i8] c"\0A\0AOriginal value: %lf\00"
@.str.3 = [11 x i8] c"\0ACeil: %lf\00"
@.str.4 = [12 x i8] c"\0AFloor: %lf\00"
@.str.5 = [18 x i8] c"\0ASquare root: %lf\00"
@.str.6 = [17 x i8] c"\0ANegative number\00"
@.str.7 = [14 x i8] c"\0ACosine: %lf\0A\00"
@.str.8 = [40 x i8] c"Enter a whole number between 2 and 10: \00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [29 x i8] c"\0A%lf to the %d power is %lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %6)
%10 = load double, double* %6
%11 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %10)
%12 = load double, double* %6
%13 = call i32 @ceil(double %12)
%14 = sitofp i32 %13 to double
%15 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), double %14)
%16 = load double, double* %6
%17 = call i32 @floor(double %16)
%18 = sitofp i32 %17 to double
%19 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %18)
%20 = load double, double* %6
%21 = fcmp oge double %20, 0.000000e+00
br i1 %21, label %22, label %27
22: ; preds = %2
%23 = load double, double* %6
%24 = call i32 @sqrt(double %23)
%25 = sitofp i32 %24 to double
%26 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), double %25)
br label %29
27: ; preds = %2
%28 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %29
29: ; preds = %27, %22
%30 = load double, double* %6
%31 = call i32 @cos(double %30)
%32 = sitofp i32 %31 to double
%33 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), double %32)
%34 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %7)
%36 = load double, double* %6
%37 = load i32, i32* %7
%38 = load double, double* %6
%39 = load i32, i32* %7
%40 = call i32 @pow(double %38, i32 %39)
%41 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), double %36, i32 %37, i32 %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [22 x i8] c"\0A\0AOriginal value: %lf\00"
@.str.3 = [11 x i8] c"\0ACeil: %lf\00"
@.str.4 = [12 x i8] c"\0AFloor: %lf\00"
@.str.5 = [18 x i8] c"\0ASquare root: %lf\00"
@.str.6 = [17 x i8] c"\0ANegative number\00"
@.str.7 = [14 x i8] c"\0ACosine: %lf\0A\00"
@.str.8 = [40 x i8] c"Enter a whole number between 2 and 10: \00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [29 x i8] c"\0A%lf to the %d power is %lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = alloca i32
%5 = bitcast double* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%9 = load double, double* %3
%10 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %9)
%11 = load double, double* %3
%12 = call i32 @ceil(double %11)
%13 = sitofp i32 %12 to double
%14 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), double %13)
%15 = load double, double* %3
%16 = call i32 @floor(double %15)
%17 = sitofp i32 %16 to double
%18 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), double %17)
%19 = load double, double* %3
%20 = fcmp ult double %19, 0.000000e+00
br i1 %20, label %25, label %21
21: ; preds = %2
%22 = call i32 @sqrt(double %19)
%23 = sitofp i32 %22 to double
%24 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), double %23)
br label %27
25: ; preds = %2
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %27
27: ; preds = %25, %21
%28 = load double, double* %3
%29 = call i32 @cos(double %28)
%30 = sitofp i32 %29 to double
%31 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), double %30)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %4)
%34 = load double, double* %3
%35 = load i32, i32* %4
%36 = call i32 @pow(double %34, i32 %35)
%37 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), double %34, i32 %35, i32 %36)
ret i32 0
}