#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 g1(double);
double g2(double);
double g3(double);
double g4(double);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int main() {
  double x[101];
  double d;
  int i;
  x[0] = 2;
  printf("apartado a)\n");
  for (i = 1; i < 100; i++) {
    x[i] = g1(x[i - 1]);
    d = x[i];
  }
  printf("sol: %lf\n", d);
  printf("presione ENTER para continuar");
  getchar();
  system("cls");
  printf("apartado b)\n");
  for (i = 1; i < 100; i++) {
    x[i] = g2(x[i - 1]);
    d = x[i];
  }
  printf("sol: %lf\n", d);
  printf("presione ENTER para continuar");
  getchar();
  system("cls");
  printf("apartado c)\n");
  for (i = 1; i < 100; i++) {
    x[i] = g3(x[i - 1]);
    d = x[i];
  }
  printf("sol: %lf\n", d);
  printf("presione ENTER para continuar");
  getchar();
  system("cls");
  printf("apartado d)\n");
  for (i = 1; i < 100; i++) {
    x[i] = g4(x[i - 1]);
    d = x[i];
  }
  printf("sol: %lf\n", d);
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xe76(%rip),%xmm0
movsd  %xmm0,-0x330(%rbp)
ff
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x33c(%rbp)
cmpl   $0x64,-0x33c(%rbp)
jge    120c <main+0x9c>
mov    -0x33c(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
call   1030 <g1@plt>
movslq -0x33c(%rbp),%rax
movsd  %xmm0,-0x330(%rbp,%rax,8)
ff ff
movslq -0x33c(%rbp),%rax
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x338(%rbp)
ff
mov    -0x33c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x33c(%rbp)
jmp    11aa <main+0x3a>
movsd  -0x338(%rbp),%xmm0
ff
lea    0xdfa(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
lea    0xdff(%rip),%rdi
call   1050 <system@plt>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x33c(%rbp)
cmpl   $0x64,-0x33c(%rbp)
jge    12bd <main+0x14d>
mov    -0x33c(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
call   1090 <g2@plt>
movslq -0x33c(%rbp),%rax
movsd  %xmm0,-0x330(%rbp,%rax,8)
ff ff
movslq -0x33c(%rbp),%rax
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x338(%rbp)
ff
mov    -0x33c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x33c(%rbp)
jmp    125b <main+0xeb>
movsd  -0x338(%rbp),%xmm0
ff
lea    0xd49(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
lea    0xd4e(%rip),%rdi
call   1050 <system@plt>
lea    0xd53(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x33c(%rbp)
cmpl   $0x64,-0x33c(%rbp)
jge    136e <main+0x1fe>
mov    -0x33c(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
call   1040 <g3@plt>
movslq -0x33c(%rbp),%rax
movsd  %xmm0,-0x330(%rbp,%rax,8)
ff ff
movslq -0x33c(%rbp),%rax
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x338(%rbp)
ff
mov    -0x33c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x33c(%rbp)
jmp    130c <main+0x19c>
movsd  -0x338(%rbp),%xmm0
ff
lea    0xc98(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xc94(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
lea    0xc9d(%rip),%rdi
call   1050 <system@plt>
lea    0xcaf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x33c(%rbp)
cmpl   $0x64,-0x33c(%rbp)
jge    141f <main+0x2af>
mov    -0x33c(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
call   1080 <g4@plt>
movslq -0x33c(%rbp),%rax
movsd  %xmm0,-0x330(%rbp,%rax,8)
ff ff
movslq -0x33c(%rbp),%rax
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x338(%rbp)
ff
mov    -0x33c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x33c(%rbp)
jmp    13bd <main+0x24d>
movsd  -0x338(%rbp),%xmm0
ff
lea    0xbe7(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xc2c(%rip),%rdi
call   1050 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
movsd  0xe6b(%rip),%xmm0
mov    $0x63,%ebx
nopw   0x0(%rax,%rax,1)
call   1040 <g1@plt>
add    $0xffffffffffffffff,%rbx
jne    11a0 <main+0x20>
lea    0xe56(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xe52(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xe5b(%rip),%rdi
call   1060 <system@plt>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
movsd  0xe12(%rip),%xmm0
mov    $0x63,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   10a0 <g2@plt>
add    $0xffffffffffffffff,%rbx
jne    1200 <main+0x80>
lea    0xdf6(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xdf2(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xdfb(%rip),%rdi
call   1060 <system@plt>
lea    0xe11(%rip),%rdi
call   1030 <puts@plt>
movsd  0xdb2(%rip),%xmm0
mov    $0x63,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1050 <g3@plt>
add    $0xffffffffffffffff,%rbx
jne    1260 <main+0xe0>
lea    0xd96(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xd92(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
lea    0xd9b(%rip),%rdi
call   1060 <system@plt>
lea    0xdbd(%rip),%rdi
call   1030 <puts@plt>
movsd  0xd52(%rip),%xmm0
mov    $0x63,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1090 <g4@plt>
add    $0xffffffffffffffff,%rbx
jne    12c0 <main+0x140>
lea    0xd36(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
lea    0xd54(%rip),%rdi
call   1060 <system@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"apartado a)\0A\00"
@.str.1 = [10 x i8] c"sol: %lf\0A\00"
@.str.2 = [30 x i8] c"presione ENTER para continuar\00"
@.str.3 = [4 x i8] c"cls\00"
@.str.4 = [13 x i8] c"apartado b)\0A\00"
@.str.5 = [13 x i8] c"apartado c)\0A\00"
@.str.6 = [13 x i8] c"apartado d)\0A\00"
@.str.7 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [101 x double]
%3 = alloca double
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 0
store double 2.000000e+00, double* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %4
br label %7
7: ; preds = %24, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 100
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %13
%15 = load double, double* %14
%16 = call double @g1(double %15)
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %18
store double %16, double* %19
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %21
%23 = load double, double* %22
store double %23, double* %3
br label %24
24: ; preds = %10
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %7
27: ; preds = %7
%28 = load double, double* %3
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 (...) @getchar()
%32 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %4
br label %34
34: ; preds = %51, %27
%35 = load i32, i32* %4
%36 = icmp slt i32 %35, 100
br i1 %36, label %37, label %54
37: ; preds = %34
%38 = load i32, i32* %4
%39 = sub nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %40
%42 = load double, double* %41
%43 = call double @g2(double %42)
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %45
store double %43, double* %46
%47 = load i32, i32* %4
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %48
%50 = load double, double* %49
store double %50, double* %3
br label %51
51: ; preds = %37
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
br label %34
54: ; preds = %34
%55 = load double, double* %3
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %55)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%58 = call i32 (...) @getchar()
%59 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %4
br label %61
61: ; preds = %78, %54
%62 = load i32, i32* %4
%63 = icmp slt i32 %62, 100
br i1 %63, label %64, label %81
64: ; preds = %61
%65 = load i32, i32* %4
%66 = sub nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %67
%69 = load double, double* %68
%70 = call double @g3(double %69)
%71 = load i32, i32* %4
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %72
store double %70, double* %73
%74 = load i32, i32* %4
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %75
%77 = load double, double* %76
store double %77, double* %3
br label %78
78: ; preds = %64
%79 = load i32, i32* %4
%80 = add nsw i32 %79, 1
store i32 %80, i32* %4
br label %61
81: ; preds = %61
%82 = load double, double* %3
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %82)
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%85 = call i32 (...) @getchar()
%86 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %4
br label %88
88: ; preds = %105, %81
%89 = load i32, i32* %4
%90 = icmp slt i32 %89, 100
br i1 %90, label %91, label %108
91: ; preds = %88
%92 = load i32, i32* %4
%93 = sub nsw i32 %92, 1
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %94
%96 = load double, double* %95
%97 = call double @g4(double %96)
%98 = load i32, i32* %4
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %99
store double %97, double* %100
%101 = load i32, i32* %4
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [101 x double], [101 x double]* %2, i64 0, i64 %102
%104 = load double, double* %103
store double %104, double* %3
br label %105
105: ; preds = %91
%106 = load i32, i32* %4
%107 = add nsw i32 %106, 1
store i32 %107, i32* %4
br label %88
108: ; preds = %88
%109 = load double, double* %3
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %109)
%111 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%112 = load i32, i32* %1
ret i32 %112
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"sol: %lf\0A\00"
@.str.2 = [30 x i8] c"presione ENTER para continuar\00"
@.str.3 = [4 x i8] c"cls\00"
@.str.7 = [6 x i8] c"PAUSE\00"
@str = [12 x i8] c"apartado a)\00"
@str.8 = [12 x i8] c"apartado b)\00"
@str.9 = [12 x i8] c"apartado c)\00"
@str.10 = [12 x i8] c"apartado d)\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
%3 = phi double [ 2.000000e+00, %0 ], [ %5, %2 ]
%4 = phi i64 [ 1, %0 ], [ %6, %2 ]
%5 = tail call double @g1(double %3)
%6 = add nuw nsw i64 %4, 1
%7 = icmp eq i64 %6, 100
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %5)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 (...) @getchar()
%12 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.8, i64 0, i64 0))
br label %14
14: ; preds = %8, %14
%15 = phi double [ 2.000000e+00, %8 ], [ %17, %14 ]
%16 = phi i64 [ 1, %8 ], [ %18, %14 ]
%17 = tail call double @g2(double %15)
%18 = add nuw nsw i64 %16, 1
%19 = icmp eq i64 %18, 100
br i1 %19, label %20, label %14
20: ; preds = %14
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %17)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%23 = tail call i32 (...) @getchar()
%24 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.9, i64 0, i64 0))
br label %26
26: ; preds = %20, %26
%27 = phi double [ 2.000000e+00, %20 ], [ %29, %26 ]
%28 = phi i64 [ 1, %20 ], [ %30, %26 ]
%29 = tail call double @g3(double %27)
%30 = add nuw nsw i64 %28, 1
%31 = icmp eq i64 %30, 100
br i1 %31, label %32, label %26
32: ; preds = %26
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %29)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%35 = tail call i32 (...) @getchar()
%36 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.10, i64 0, i64 0))
br label %38
38: ; preds = %32, %38
%39 = phi double [ 2.000000e+00, %32 ], [ %41, %38 ]
%40 = phi i64 [ 1, %32 ], [ %42, %38 ]
%41 = tail call double @g4(double %39)
%42 = add nuw nsw i64 %40, 1
%43 = icmp eq i64 %42, 100
br i1 %43, label %44, label %38
44: ; preds = %38
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %41)
%46 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}