#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 *, ...);
void imprime_matriz_lu(double **A, long n) {
  long i, j;
  float u = 1, c = 0;
  printf("\n *************** MATRIZ L:****************\n");
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (i < j)
        printf("%f ", c);
      else if (i > j)
        printf("%f ", A[j][i]);
      else
        printf("%f ", u);
    }
    printf("\n");
  }
  printf("\n *************** MATRIZ U:****************\n");
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (i <= j)
        printf("%f ", A[j][i]);
      else
        printf("%f ", c);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<imprime_matriz_lu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xed8(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1220 <imprime_matriz_lu+0x110>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1201 <imprime_matriz_lu+0xf1>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1199 <imprime_matriz_lu+0x89>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11eb <imprime_matriz_lu+0xdb>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jle    11cf <imprime_matriz_lu+0xbf>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe6e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11e6 <imprime_matriz_lu+0xd6>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe52(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11eb <imprime_matriz_lu+0xdb>
jmp    11f0 <imprime_matriz_lu+0xe0>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1161 <imprime_matriz_lu+0x51>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114b <imprime_matriz_lu+0x3b>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    12dc <imprime_matriz_lu+0x1cc>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    12bd <imprime_matriz_lu+0x1ad>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jg     1290 <imprime_matriz_lu+0x180>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xdad(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12a7 <imprime_matriz_lu+0x197>
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd91(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12ac <imprime_matriz_lu+0x19c>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    124c <imprime_matriz_lu+0x13c>
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1236 <imprime_matriz_lu+0x126>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprime_matriz_lu>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xec6(%rip),%rdi
call   1040 <puts@plt>
test   %r12,%r12
jle    1221 <imprime_matriz_lu+0xf1>
xor    %r13d,%r13d
lea    0xeaa(%rip),%r15
jmp    1173 <imprime_matriz_lu+0x43>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
cmp    %r12,%r13
je     11b1 <imprime_matriz_lu+0x81>
xor    %ebx,%ebx
jmp    1193 <imprime_matriz_lu+0x63>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     1160 <imprime_matriz_lu+0x30>
xorps  %xmm0,%xmm0
cmp    %rbx,%r13
jb     1180 <imprime_matriz_lu+0x50>
movsd  0xe5d(%rip),%xmm0
jbe    1180 <imprime_matriz_lu+0x50>
mov    (%r14,%rbx,8),%rax
movsd  (%rax,%r13,8),%xmm0
jmp    1180 <imprime_matriz_lu+0x50>
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
test   %r12,%r12
jle    1217 <imprime_matriz_lu+0xe7>
xor    %r13d,%r13d
lea    0xe3c(%rip),%r15
jmp    11e3 <imprime_matriz_lu+0xb3>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
cmp    %r12,%r13
je     1217 <imprime_matriz_lu+0xe7>
xor    %ebx,%ebx
jmp    1203 <imprime_matriz_lu+0xd3>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     11d0 <imprime_matriz_lu+0xa0>
xorps  %xmm0,%xmm0
cmp    %rbx,%r13
ja     11f0 <imprime_matriz_lu+0xc0>
mov    (%r14,%rbx,8),%rax
movsd  (%rax,%r13,8),%xmm0
jmp    11f0 <imprime_matriz_lu+0xc0>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe10(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"\0A *************** MATRIZ L:****************\0A\00"
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [45 x i8] c"\0A *************** MATRIZ U:****************\0A\00"
define void @imprime_matriz_lu(double** %0, i64 %1) {
%3 = alloca double**
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca float
%8 = alloca float
store double** %0, double*** %3
store i64 %1, i64* %4
store float 1.000000e+00, float* %7
store float 0.000000e+00, float* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %5
br label %10
10: ; preds = %51, %2
%11 = load i64, i64* %5
%12 = load i64, i64* %4
%13 = icmp slt i64 %11, %12
br i1 %13, label %14, label %54
14: ; preds = %10
store i64 0, i64* %6
br label %15
15: ; preds = %46, %14
%16 = load i64, i64* %6
%17 = load i64, i64* %4
%18 = icmp slt i64 %16, %17
br i1 %18, label %19, label %49
19: ; preds = %15
%20 = load i64, i64* %5
%21 = load i64, i64* %6
%22 = icmp slt i64 %20, %21
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load float, float* %8
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %25)
br label %45
27: ; preds = %19
%28 = load i64, i64* %5
%29 = load i64, i64* %6
%30 = icmp sgt i64 %28, %29
br i1 %30, label %31, label %40
31: ; preds = %27
%32 = load double**, double*** %3
%33 = load i64, i64* %6
%34 = getelementptr inbounds double*, double** %32, i64 %33
%35 = load double*, double** %34
%36 = load i64, i64* %5
%37 = getelementptr inbounds double, double* %35, i64 %36
%38 = load double, double* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %38)
br label %44
40: ; preds = %27
%41 = load float, float* %7
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %42)
br label %44
44: ; preds = %40, %31
br label %45
45: ; preds = %44, %23
br label %46
46: ; preds = %45
%47 = load i64, i64* %6
%48 = add nsw i64 %47, 1
store i64 %48, i64* %6
br label %15
49: ; preds = %15
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %51
51: ; preds = %49
%52 = load i64, i64* %5
%53 = add nsw i64 %52, 1
store i64 %53, i64* %5
br label %10
54: ; preds = %10
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
store i64 0, i64* %5
br label %56
56: ; preds = %88, %54
%57 = load i64, i64* %5
%58 = load i64, i64* %4
%59 = icmp slt i64 %57, %58
br i1 %59, label %60, label %91
60: ; preds = %56
store i64 0, i64* %6
br label %61
61: ; preds = %83, %60
%62 = load i64, i64* %6
%63 = load i64, i64* %4
%64 = icmp slt i64 %62, %63
br i1 %64, label %65, label %86
65: ; preds = %61
%66 = load i64, i64* %5
%67 = load i64, i64* %6
%68 = icmp sle i64 %66, %67
br i1 %68, label %69, label %78
69: ; preds = %65
%70 = load double**, double*** %3
%71 = load i64, i64* %6
%72 = getelementptr inbounds double*, double** %70, i64 %71
%73 = load double*, double** %72
%74 = load i64, i64* %5
%75 = getelementptr inbounds double, double* %73, i64 %74
%76 = load double, double* %75
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %76)
br label %82
78: ; preds = %65
%79 = load float, float* %8
%80 = fpext float %79 to double
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %80)
br label %82
82: ; preds = %78, %69
br label %83
83: ; preds = %82
%84 = load i64, i64* %6
%85 = add nsw i64 %84, 1
store i64 %85, i64* %6
br label %61
86: ; preds = %61
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %88
88: ; preds = %86
%89 = load i64, i64* %5
%90 = add nsw i64 %89, 1
store i64 %90, i64* %5
br label %56
91: ; preds = %56
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%f \00"
@str = [44 x i8] c"\0A *************** MATRIZ L:****************\00"
@str.4 = [44 x i8] c"\0A *************** MATRIZ U:****************\00"
define void @imprime_matriz_lu(double** nocapture %0, i64 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%4 = icmp sgt i64 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.4, i64 0, i64 0))
br label %49
7: ; preds = %2, %24
%8 = phi i64 [ %26, %24 ], [ 0, %2 ]
br label %9
9: ; preds = %7, %19
%10 = phi i64 [ %22, %19 ], [ 0, %7 ]
%11 = icmp ult i64 %8, %10
br i1 %11, label %19, label %12
12: ; preds = %9
%13 = icmp ugt i64 %8, %10
br i1 %13, label %14, label %19
14: ; preds = %12
%15 = getelementptr inbounds double*, double** %0, i64 %10
%16 = load double*, double** %15
%17 = getelementptr inbounds double, double* %16, i64 %8
%18 = load double, double* %17
br label %19
19: ; preds = %12, %9, %14
%20 = phi double [ %18, %14 ], [ 0.000000e+00, %9 ], [ 1.000000e+00, %12 ]
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %20)
%22 = add nuw nsw i64 %10, 1
%23 = icmp eq i64 %22, %1
br i1 %23, label %24, label %9
24: ; preds = %19
%25 = tail call i32 @putchar(i32 10)
%26 = add nuw nsw i64 %8, 1
%27 = icmp eq i64 %26, %1
br i1 %27, label %28, label %7
28: ; preds = %24
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.4, i64 0, i64 0))
br i1 %4, label %30, label %49
30: ; preds = %28, %45
%31 = phi i64 [ %47, %45 ], [ 0, %28 ]
br label %32
32: ; preds = %30, %40
%33 = phi i64 [ %43, %40 ], [ 0, %30 ]
%34 = icmp ugt i64 %31, %33
br i1 %34, label %40, label %35
35: ; preds = %32
%36 = getelementptr inbounds double*, double** %0, i64 %33
%37 = load double*, double** %36
%38 = getelementptr inbounds double, double* %37, i64 %31
%39 = load double, double* %38
br label %40
40: ; preds = %32, %35
%41 = phi double [ %39, %35 ], [ 0.000000e+00, %32 ]
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %41)
%43 = add nuw nsw i64 %33, 1
%44 = icmp eq i64 %43, %1
br i1 %44, label %45, label %32
45: ; preds = %40
%46 = tail call i32 @putchar(i32 10)
%47 = add nuw nsw i64 %31, 1
%48 = icmp eq i64 %47, %1
br i1 %48, label %49, label %30
49: ; preds = %45, %5, %28
ret void
}