#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 display_result(int nou, double mat[nou][nou + 1]) {
  printf("\nResult:\n");
  for (int row = 0; row < nou; row++) {
    printf("x_%d = %lf\n", row + 1, mat[row][nou]);
  }
}


x86 assembly (clang, -O0):
<display_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %rax,-0x20(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    118e <display_result+0x7e>
mov    -0x20(%rbp),%rdx
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe91(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <display_result+0x30>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_result>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    117e <display_result+0x5e>
lea    0x1(%rbx),%r15d
mov    %ebx,%r12d
lea    (%r14,%r12,8),%r13
shl    $0x3,%r15
xor    %ebx,%ebx
lea    0xeaa(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
movsd  0x0(%r13),%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
add    %r15,%r13
cmp    %rbx,%r12
jne    1160 <display_result+0x40>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"\0AResult:\0A\00"
@.str.1 = [12 x i8] c"x_%d = %lf\0A\00"
define void @display_result(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
store i32 %0, i32* %3
store double* %1, double** %4
%6 = load i32, i32* %3
%7 = zext i32 %6 to i64
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = zext i32 %9 to i64
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %12
12: ; preds = %29, %2
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %32
16: ; preds = %12
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
%19 = load double*, double** %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = mul nsw i64 %21, %10
%23 = getelementptr inbounds double, double* %19, i64 %22
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %18, double %27)
br label %29
29: ; preds = %16
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %12
32: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"x_%d = %lf\0A\00"
@str = [9 x i8] c"\0AResult:\00"
define void @display_result(i32 %0, double* nocapture %1) {
%3 = add nsw i32 %0, 1
%4 = zext i32 %3 to i64
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = zext i32 %0 to i64
%9 = zext i32 %0 to i64
%10 = getelementptr inbounds double, double* %1, i64 %8
br label %12
11: ; preds = %12, %2
ret void
12: ; preds = %7, %12
%13 = phi i64 [ 0, %7 ], [ %14, %12 ]
%14 = add nuw nsw i64 %13, 1
%15 = mul nuw nsw i64 %13, %4
%16 = getelementptr inbounds double, double* %10, i64 %15
%17 = load double, double* %16
%18 = trunc i64 %14 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %18, double %17)
%20 = icmp eq i64 %14, %9
br i1 %20, label %11, label %12
}