#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 M_PI;
double ceil(double);
double floor(double);
double pow(double, double);
int /*<<< orphan*/ printf(char *, int, ...);
double sin(double);
int main(void) {
  int n, m, nPlusM;
  n = 7;
  m = 8;
  nPlusM = n + m;
  printf("%d + %d = %d.\n", n, m, nPlusM);
  double x, y;
  x = M_PI;
  y = 2.0;
  printf("sin(%f) = %f.\n", x, sin(x));
  printf("x is between %f and %f.\n", floor(x), ceil(x));
  printf("%f^2 = %f. Also, %f^2 = %f.\n", x, pow(x, y), x, x * x);
  printf("An int occupies %d bytes, and a double occupies %d bytes.\n",
         (int)sizeof(int), (int)sizeof(double));
  printf("sizeof(unsigned int) = %d.\n", (int)sizeof(unsigned int));
  printf("sizeof(char) = %d and sizeof(unsigned char) = %d.\n",
         (int)sizeof(char), (int)sizeof(unsigned char));
  printf("sizeof(short) = %d and sizeof(unsigned short) = %d.\n",
         (int)sizeof(short), (int)sizeof(unsigned short));
  printf("sizeof(long) = %d and sizeof(unsigned long) = %d.\n",
         (int)sizeof(long), (int)sizeof(unsigned long));
  printf("sizeof(float) = %d.\n", (int)sizeof(float));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0x8(%rbp)
movl   $0x8,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e54(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe5b(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
mov    -0x2c(%rbp),%esi
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   1070 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <ceil@plt>
mov    -0x28(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1060 <pow@plt>
mov    -0x24(%rbp),%esi
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mulsd  -0x18(%rbp),%xmm2
lea    0xe16(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xe25(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe48(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe51(%rip),%rdi
mov    $0x1,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6f(%rip),%rdi
mov    $0x2,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8f(%rip),%rdi
mov    $0x8,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
mov    $0x7,%esi
mov    $0x8,%edx
mov    $0xf,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e81(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,(%rsp)
cvttsd2si %xmm0,%ebx
call   1050 <sin@plt>
lea    0xe8f(%rip),%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
call   1060 <floor@plt>
cvttsd2si %xmm0,%ebp
movsd  (%rsp),%xmm0
call   1030 <ceil@plt>
lea    0xe76(%rip),%rdi
mov    %ebp,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
lea    0xe72(%rip),%rdi
mov    %ebx,%esi
movapd %xmm0,%xmm2
mov    $0x3,%al
call   1040 <printf@plt>
lea    0xe7b(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec2(%rip),%rdi
mov    $0x2,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0x8,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%d + %d = %d.\0A\00"
@M_PI = global double 0.000000e+00
@.str.1 = [15 x i8] c"sin(%f) = %f.\0A\00"
@.str.2 = [25 x i8] c"x is between %f and %f.\0A\00"
@.str.3 = [29 x i8] c"%f^2 = %f. Also, %f^2 = %f.\0A\00"
@.str.4 = [59 x i8] c"An int occupies %d bytes, and a double occupies %d bytes.\0A\00"
@.str.5 = [28 x i8] c"sizeof(unsigned int) = %d.\0A\00"
@.str.6 = [51 x i8] c"sizeof(char) = %d and sizeof(unsigned char) = %d.\0A\00"
@.str.7 = [53 x i8] c"sizeof(short) = %d and sizeof(unsigned short) = %d.\0A\00"
@.str.8 = [51 x i8] c"sizeof(long) = %d and sizeof(unsigned long) = %d.\0A\00"
@.str.9 = [21 x i8] c"sizeof(float) = %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store i32 7, i32* %2
store i32 8, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = add nsw i32 %7, %8
store i32 %9, i32* %4
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11, i32 %12)
%14 = load double, double* @M_PI
store double %14, double* %5
store double 2.000000e+00, double* %6
%15 = load double, double* %5
%16 = fptosi double %15 to i32
%17 = load double, double* %5
%18 = call double @sin(double %17)
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %16, double %18)
%20 = load double, double* %5
%21 = call double @llvm.floor.f64(double %20)
%22 = fptosi double %21 to i32
%23 = load double, double* %5
%24 = call double @llvm.ceil.f64(double %23)
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %22, double %24)
%26 = load double, double* %5
%27 = fptosi double %26 to i32
%28 = load double, double* %5
%29 = load double, double* %6
%30 = call double @pow(double %28, double %29)
%31 = load double, double* %5
%32 = load double, double* %5
%33 = load double, double* %5
%34 = fmul double %32, %33
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %27, double %30, double %31, double %34)
%36 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i32 4, i32 8)
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 4)
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i32 1, i32 1)
%39 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0), i32 2, i32 2)
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), i32 8, i32 8)
%41 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 4)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"%d + %d = %d.\0A\00"
@M_PI = global double 0.000000e+00
@.str.1 = [15 x i8] c"sin(%f) = %f.\0A\00"
@.str.2 = [25 x i8] c"x is between %f and %f.\0A\00"
@.str.3 = [29 x i8] c"%f^2 = %f. Also, %f^2 = %f.\0A\00"
@.str.4 = [59 x i8] c"An int occupies %d bytes, and a double occupies %d bytes.\0A\00"
@.str.5 = [28 x i8] c"sizeof(unsigned int) = %d.\0A\00"
@.str.6 = [51 x i8] c"sizeof(char) = %d and sizeof(unsigned char) = %d.\0A\00"
@.str.7 = [53 x i8] c"sizeof(short) = %d and sizeof(unsigned short) = %d.\0A\00"
@.str.8 = [51 x i8] c"sizeof(long) = %d and sizeof(unsigned long) = %d.\0A\00"
@.str.9 = [21 x i8] c"sizeof(float) = %d.\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 7, i32 8, i32 15)
%2 = load double, double* @M_PI
%3 = fptosi double %2 to i32
%4 = tail call double @sin(double %2)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %3, double %4)
%6 = tail call double @llvm.floor.f64(double %2)
%7 = fptosi double %6 to i32
%8 = tail call double @llvm.ceil.f64(double %2)
%9 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %7, double %8)
%10 = fmul double %2, %2
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %3, double %10, double %2, double %10)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0), i32 4, i32 8)
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 4)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.6, i64 0, i64 0), i32 1, i32 1)
%15 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0), i32 2, i32 2)
%16 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), i32 8, i32 8)
%17 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 4)
ret i32 0
}