#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);
int /*<<< orphan*/ scanf(char *, double *);
void fill_matrix(int nou, double mat[nou][nou + 1]) {
  for (int c = 0; c < nou; c++) {
    printf("Enter the cofficients for the variables in equation #%d:\n", c + 1);
    for (int d = 0; d < nou; d++) {
      printf("c_%d = ", d + 1);
      scanf(" %lf", &mat[c][d]);
    }
    printf("Enter the right-hand side of equation #%d: ", c + 1);
    scanf(" %lf", &mat[c][nou]);
  }
}


x86 assembly (clang, -O0):
<fill_matrix>:
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)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    120f <fill_matrix+0xef>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c1 <fill_matrix+0xa1>
mov    -0x18(%rbp),%esi
add    $0x1,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
imul   %rcx,%rax
shl    $0x3,%rax
add    %rax,%rsi
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe94(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1167 <fill_matrix+0x47>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
imul   %rcx,%rax
shl    $0x3,%rax
add    %rax,%rsi
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe46(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <fill_matrix+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
test   %edi,%edi
jle    11f9 <fill_matrix+0xd9>
mov    %rsi,%rbp
lea    0x1(%rdi),%eax
mov    %edi,%r15d
lea    (%rsi,%r15,8),%rcx
mov    %rcx,0x8(%rsp)
mov    %rax,0x10(%rsp)
lea    0x0(,%rax,8),%rax
mov    %rax,(%rsp)
xor    %r12d,%r12d
lea    0xed7(%rip),%r13
lea    0xed8(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r12,%r14
lea    0x1(%r12),%rsi
lea    0xe81(%rip),%rdi
mov    %rsi,0x18(%rsp)
call   1030 <printf@plt>
imul   0x10(%rsp),%r14
mov    %rbp,0x20(%rsp)
mov    %rbp,%r12
xor    %ebp,%ebp
nopl   0x0(%rax)
add    $0x1,%rbp
mov    %r13,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
add    $0x8,%r12
cmp    %rbp,%r15
jne    11a0 <fill_matrix+0x80>
lea    0xe7e(%rip),%rdi
mov    0x18(%rsp),%r12
mov    %r12d,%esi
call   1030 <printf@plt>
mov    0x8(%rsp),%rax
lea    (%rax,%r14,8),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x20(%rsp),%rbp
add    (%rsp),%rbp
cmp    %r15,%r12
jne    1170 <fill_matrix+0x50>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [58 x i8] c"Enter the cofficients for the variables in equation #%d:\0A\00"
@.str.1 = [8 x i8] c"c_%d = \00"
@.str.2 = [5 x i8] c" %lf\00"
@.str.3 = [44 x i8] c"Enter the right-hand side of equation #%d: \00"
define void @fill_matrix(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store double* %1, double** %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = zext i32 %10 to i64
store i32 0, i32* %5
br label %12
12: ; preds = %53, %2
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %56
16: ; preds = %12
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
%19 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 0, i32* %6
br label %20
20: ; preds = %37, %16
%21 = load i32, i32* %6
%22 = load i32, i32* %3
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %40
24: ; preds = %20
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
%27 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = load double*, double** %4
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = mul nsw i64 %30, %11
%32 = getelementptr inbounds double, double* %28, i64 %31
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
%36 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double* %35)
br label %37
37: ; preds = %24
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %20
40: ; preds = %20
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
%43 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %42)
%44 = load double*, double** %4
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = mul nsw i64 %46, %11
%48 = getelementptr inbounds double, double* %44, i64 %47
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double* %51)
br label %53
53: ; preds = %40
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
store i32 %55, i32* %5
br label %12
56: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [58 x i8] c"Enter the cofficients for the variables in equation #%d:\0A\00"
@.str.1 = [8 x i8] c"c_%d = \00"
@.str.2 = [5 x i8] c" %lf\00"
@.str.3 = [44 x i8] c"Enter the right-hand side of equation #%d: \00"
define void @fill_matrix(i32 %0, double* %1) {
%3 = add nsw i32 %0, 1
%4 = zext i32 %3 to i64
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = zext i32 %0 to i64
%8 = zext i32 %0 to i64
%9 = getelementptr inbounds double, double* %1, i64 %7
br label %11
10: ; preds = %18, %2
ret void
11: ; preds = %18, %6
%12 = phi i64 [ 0, %6 ], [ %13, %18 ]
%13 = add nuw nsw i64 %12, 1
%14 = trunc i64 %13 to i32
%15 = tail call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = mul nuw nsw i64 %12, %4
%17 = getelementptr inbounds double, double* %1, i64 %16
br label %23
18: ; preds = %23
%19 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%20 = getelementptr inbounds double, double* %9, i64 %16
%21 = tail call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double* %20)
%22 = icmp eq i64 %13, %8
br i1 %22, label %10, label %11
23: ; preds = %11, %23
%24 = phi i64 [ 0, %11 ], [ %25, %23 ]
%25 = add nuw nsw i64 %24, 1
%26 = trunc i64 %25 to i32
%27 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = getelementptr inbounds double, double* %17, i64 %24
%29 = tail call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double* %28)
%30 = icmp eq i64 %25, %8
br i1 %30, label %18, label %23
}