#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*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int main() {
  double A[5][5] = {{4, 1, 0, 0, 0},
                    {2, 3, 1, 0, 0},
                    {0, 1, 1, 1, 0},
                    {0, 0, 2, 1, 2},
                    {0, 0, 0, 3, 1}};
  double B[5] = {9, 7, 0, 1, -2};
  double x[5];
  double k;
  int i;
  for (i = 1; i < 5; i++) {
    k = -A[i][i - 1] / A[i - 1][i - 1];
    A[i][i] = A[i][i] + k * A[i - 1][i];
    B[i] = B[i] + k * B[i - 1];
  }
  printf("Soluciones:\n\n");
  x[5 - 1] = B[5 - 1] / A[5 - 1][5 - 1];
  for (i = 5 - 2; i >= 0; i--) {
    x[i] = (B[i] - A[i][i + 1] * x[i + 1]) / A[i][i];
  }
  for (i = 0; i < 5; i++)
    printf("X%d= %.0lf\n", i + 1, x[i]);
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xec0(%rip),%rsi
mov    $0xc8,%edx
call   1060 <memcpy@plt>
lea    -0x100(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xe93(%rip),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  0xe7b(%rip),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  0xe63(%rip),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  0xe4b(%rip),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movl   $0x1,-0x13c(%rbp)
cmpl   $0x5,-0x13c(%rbp)
jge    1314 <main+0x1d4>
movslq -0x13c(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
mov    -0x13c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x13c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0xd0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
mov    -0x13c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x138(%rbp)
ff
movslq -0x13c(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x13c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x138(%rbp),%xmm0
ff
mov    -0x13c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0xd0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x13c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x13c(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x13c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movslq -0x13c(%rbp),%rax
movsd  -0x100(%rbp,%rax,8),%xmm1
ff ff
movsd  -0x138(%rbp),%xmm0
ff
mov    -0x13c(%rbp),%eax
sub    $0x1,%eax
cltq
movsd  -0x100(%rbp,%rax,8),%xmm2
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x13c(%rbp),%rax
movsd  %xmm0,-0x100(%rbp,%rax,8)
ff ff
mov    -0x13c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13c(%rbp)
jmp    11c7 <main+0x87>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0xe0(%rbp),%xmm0
ff
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movl   $0x3,-0x13c(%rbp)
cmpl   $0x0,-0x13c(%rbp)
jl     13fc <main+0x2bc>
movslq -0x13c(%rbp),%rax
movsd  -0x100(%rbp,%rax,8),%xmm1
ff ff
movslq -0x13c(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
mov    -0x13c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x13c(%rbp),%eax
add    $0x1,%eax
cltq
movsd  -0x130(%rbp,%rax,8),%xmm2
ff ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x13c(%rbp),%rcx
lea    -0xd0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x13c(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
movslq -0x13c(%rbp),%rax
movsd  %xmm0,-0x130(%rbp,%rax,8)
ff ff
mov    -0x13c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x13c(%rbp)
jmp    1341 <main+0x201>
movl   $0x0,-0x13c(%rbp)
cmpl   $0x5,-0x13c(%rbp)
jge    144e <main+0x30e>
mov    -0x13c(%rbp),%esi
add    $0x1,%esi
movslq -0x13c(%rbp),%rax
movsd  -0x130(%rbp,%rax,8),%xmm0
ff ff
lea    0xcc3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x13c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13c(%rbp)
jmp    1406 <main+0x2c6>
lea    0xcad(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xefa(%rip),%rdi
call   1030 <puts@plt>
lea    0xedc(%rip),%rbx
movsd  0xeb4(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xea5(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xe84(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  0xe75(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe73(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.A = [5 x [5 x double]] [[5 x double] [double 4.000000e+00, double 1.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00], [5 x double] [double 2.000000e+00, double 3.000000e+00, double 1.000000e+00, double 0.000000e+00, double 0.000000e+00], [5 x double] [double 0.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 0.000000e+00], [5 x double] [double 0.000000e+00, double 0.000000e+00, double 2.000000e+00, double 1.000000e+00, double 2.000000e+00], [5 x double] [double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 3.000000e+00, double 1.000000e+00]]
@.str = [14 x i8] c"Soluciones:\0A\0A\00"
@.str.1 = [12 x i8] c"X%d= %.0lf\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [5 x double]]
%3 = alloca [5 x double]
%4 = alloca [5 x double]
%5 = alloca double
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [5 x [5 x double]]* %2 to i8*
%8 = bitcast [5 x double]* %3 to i8*
%9 = bitcast i8* %8 to [5 x double]*
%10 = getelementptr inbounds [5 x double], [5 x double]* %9, i32 0, i32 0
store double 9.000000e+00, double* %10
%11 = getelementptr inbounds [5 x double], [5 x double]* %9, i32 0, i32 1
store double 7.000000e+00, double* %11
%12 = getelementptr inbounds [5 x double], [5 x double]* %9, i32 0, i32 3
store double 1.000000e+00, double* %12
%13 = getelementptr inbounds [5 x double], [5 x double]* %9, i32 0, i32 4
store double -2.000000e+00, double* %13
store i32 1, i32* %6
br label %14
14: ; preds = %74, %0
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 5
br i1 %16, label %17, label %77
17: ; preds = %14
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [5 x [5 x double]], [5 x [5 x double]]* %2, i64 0, i64 %19
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x double], [5 x double]* %20, i64 0, i64 %23
%25 = load double, double* %24
%26 = fneg double %25
%27 = load i32, i32* %6
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [5 x [5 x double]], [5 x [5 x double]]* %2, i64 0, i64 %29
%31 = load i32, i32* %6
%32 = sub nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [5 x double], [5 x double]* %30, i64 0, i64 %33
%35 = load double, double* %34
%36 = fdiv double %26, %35
store double %36, double* %5
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [5 x [5 x double]], [5 x [5 x double]]* %2, i64 0, i64 %38
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [5 x double], [5 x double]* %39, i64 0, i64 %41
%43 = load double, double* %42
%44 = load double, double* %5
%45 = load i32, i32* %6
%46 = sub nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [5 x [5 x double]], [5 x [5 x double]]* %2, i64 0, i64 %47
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [5 x double], [5 x double]* %48, i64 0, i64 %50
%52 = load double, double* %51
%53 = call double @llvm.fmuladd.f64(double %44, double %52, double %43)
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [5 x [5 x double]], [5 x [5 x double]]* %2, i64 0, i64 %55
%57 = load i32, i32* %6
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [5 x double], [5 x double]* %56, i64 0, i64 %58
store double %53, double* %59
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 %61
%63 = load double, double* %62
%64 = load double, double* %5
%65 = load i32, i32* %6
%66 = sub nsw i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 %67
%69 = load double, double* %68
%70 = call double @llvm.fmuladd.f64(double %64, double %69, double %63)
%71 = load i32, i32* %6
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 %72
store double %70, double* %73
br label %74
74: ; preds = %17
%75 = load i32, i32* %6
%76 = add nsw i32 %75, 1
store i32 %76, i32* %6
br label %14
77: ; preds = %14
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%79 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 4
%80 = load double, double* %79
%81 = getelementptr inbounds [5 x [5 x double]], [5 x [5 x double]]* %2, i64 0, i64 4
%82 = getelementptr inbounds [5 x double], [5 x double]* %81, i64 0, i64 4
%83 = load double, double* %82
%84 = fdiv double %80, %83
%85 = getelementptr inbounds [5 x double], [5 x double]* %4, i64 0, i64 4
store double %84, double* %85
store i32 3, i32* %6
br label %86
86: ; preds = %120, %77
%87 = load i32, i32* %6
%88 = icmp sge i32 %87, 0
br i1 %88, label %89, label %123
89: ; preds = %86
%90 = load i32, i32* %6
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [5 x double], [5 x double]* %3, i64 0, i64 %91
%93 = load double, double* %92
%94 = load i32, i32* %6
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [5 x [5 x double]], [5 x [5 x double]]* %2, i64 0, i64 %95
%97 = load i32, i32* %6
%98 = add nsw i32 %97, 1
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [5 x double], [5 x double]* %96, i64 0, i64 %99
%101 = load double, double* %100
%102 = load i32, i32* %6
%103 = add nsw i32 %102, 1
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [5 x double], [5 x double]* %4, i64 0, i64 %104
%106 = load double, double* %105
%107 = fneg double %101
%108 = call double @llvm.fmuladd.f64(double %107, double %106, double %93)
%109 = load i32, i32* %6
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [5 x [5 x double]], [5 x [5 x double]]* %2, i64 0, i64 %110
%112 = load i32, i32* %6
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [5 x double], [5 x double]* %111, i64 0, i64 %113
%115 = load double, double* %114
%116 = fdiv double %108, %115
%117 = load i32, i32* %6
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [5 x double], [5 x double]* %4, i64 0, i64 %118
store double %116, double* %119
br label %120
120: ; preds = %89
%121 = load i32, i32* %6
%122 = add nsw i32 %121, -1
store i32 %122, i32* %6
br label %86
123: ; preds = %86
store i32 0, i32* %6
br label %124
124: ; preds = %135, %123
%125 = load i32, i32* %6
%126 = icmp slt i32 %125, 5
br i1 %126, label %127, label %138
127: ; preds = %124
%128 = load i32, i32* %6
%129 = add nsw i32 %128, 1
%130 = load i32, i32* %6
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [5 x double], [5 x double]* %4, i64 0, i64 %131
%133 = load double, double* %132
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %129, double %133)
br label %135
135: ; preds = %127
%136 = load i32, i32* %6
%137 = add nsw i32 %136, 1
store i32 %137, i32* %6
br label %124
138: ; preds = %124
%139 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%140 = load i32, i32* %1
ret i32 %140
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"X%d= %.0lf\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
@str = [13 x i8] c"Soluciones:\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 1, double 2.000000e+00)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 2, double 1.000000e+00)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 3, double 0.000000e+00)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 4, double -1.000000e+00)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 5, double 0x3FF0000000000001)
%7 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}