#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 cos(double);
double exp(double);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char const *argv[]) {
  printf("FUNC(x) = %s\n", "(exp(-0.1*(x))*1.0*cos(x))");
  printf("\n %10s %25s\n", "x", "y = FUNC(x)");
  printf("-----------------------------------------\n");
  for (double x = 0.0; x < 2 * 3.14159 + (3.14159 / 8) / 2; x += (3.14159 / 8))
    printf("%15f %20f\n", x, (exp(-0.1 * (x)) * 1.0 * cos(x)));
  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    0xed3(%rip),%rdi
lea    0xeda(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    0xeed(%rip),%rsi
lea    0xee8(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe6b(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    120d <main+0xdd>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe5e(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <exp@plt>
movsd  0xe44(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm1
lea    0xea0(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xe1a(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    118d <main+0x5d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xfe0(%rip),%rdi
lea    0xfe7(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xff4(%rip),%rdi
lea    0xffa(%rip),%rsi
lea    0xff5(%rip),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xffe(%rip),%rdi
call   1030 <puts@plt>
lea    0xfe7(%rip),%rbx
movsd  0xe93(%rip),%xmm1
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe86(%rip),%xmm0
movsd  0xe86(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe7c(%rip),%xmm0
movsd  0xe7c(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe72(%rip),%xmm0
movsd  0xe72(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe68(%rip),%xmm0
movsd  0xe68(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe5e(%rip),%xmm0
movsd  0xe5e(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe54(%rip),%xmm0
movsd  0xe54(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe4a(%rip),%xmm0
movsd  0xe4a(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe40(%rip),%xmm0
movsd  0xe40(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe36(%rip),%xmm0
movsd  0xe36(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe2c(%rip),%xmm0
movsd  0xe2c(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe22(%rip),%xmm0
movsd  0xe22(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe18(%rip),%xmm0
movsd  0xe18(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe0e(%rip),%xmm0
movsd  0xe0e(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xe04(%rip),%xmm0
movsd  0xe04(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xdfa(%rip),%xmm0
movsd  0xdfa(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movsd  0xdf0(%rip),%xmm0
movsd  0xdf0(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"FUNC(x) = %s\0A\00"
@.str.1 = [27 x i8] c"(exp(-0.1*(x))*1.0*cos(x))\00"
@.str.2 = [13 x i8] c"\0A %10s %25s\0A\00"
@.str.3 = [2 x i8] c"x\00"
@.str.4 = [12 x i8] c"y = FUNC(x)\00"
@.str.5 = [43 x i8] c"-----------------------------------------\0A\00"
@.str.6 = [11 x i8] c"%15f %20f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0))
store double 0.000000e+00, double* %6
br label %10
10: ; preds = %23, %2
%11 = load double, double* %6
%12 = fcmp olt double %11, 0x4019EB09BF9C62A1
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load double, double* %6
%15 = load double, double* %6
%16 = fmul double -1.000000e-01, %15
%17 = call double @exp(double %16)
%18 = fmul double %17, 1.000000e+00
%19 = load double, double* %6
%20 = call double @cos(double %19)
%21 = fmul double %18, %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double %14, double %21)
br label %23
23: ; preds = %13
%24 = load double, double* %6
%25 = fadd double %24, 0x3FD921F9F01B866E
store double %25, double* %6
br label %10
26: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"FUNC(x) = %s\0A\00"
@.str.1 = [27 x i8] c"(exp(-0.1*(x))*1.0*cos(x))\00"
@.str.2 = [13 x i8] c"\0A %10s %25s\0A\00"
@.str.3 = [2 x i8] c"x\00"
@.str.4 = [12 x i8] c"y = FUNC(x)\00"
@.str.6 = [11 x i8] c"%15f %20f\0A\00"
@str = [42 x i8] c"-----------------------------------------\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0.000000e+00, double 1.000000e+00)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x3FD921F9F01B866E, double 0x3FEC6CF8A3F2D8FB)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x3FE921F9F01B866E, double 0x3FE4EB14228D3E6D)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x3FF2D97B7414A4D2, double 0x3FD5C518BCB59570)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x3FF921F9F01B866E, double 0x3EB3062DBCCF3F72)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x3FFF6A786C22680A, double 0xBFD42019FC54C9DF)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x4002D97B7414A4D3, double 0xBFE1E0A1A72D6799)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x4005FDBAB21815A1, double 0xBFE67564C37079C8)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x400921F9F01B866F, double 0xBFE75F75DEECC6E9)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x400C46392E1EF73D, double 0xBFE4C3206B4F44D6)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x400F6A786C22680B, double 0xBFDE8EC02418FD9C)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x4011475BD512EC6C, double 0xBFCFCD438CC5AD8F)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x4012D97B7414A4D3, double 0xBEC4D7C9EFE0A28D)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x40146B9B13165D3A, double 0x3FCD662BE04C4A31)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x4015FDBAB21815A1, double 0x3FDA1D8D492B8EFA)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x40178FDA5119CE08, double 0x3FE0675E7ACA0F2A)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), double 0x401921F9F01B866F, double 0x3FE112563601A3D5)
ret i32 0
}