#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 dump_system(double *A, int m, int n, int stride, double *b) {
  int i, j;
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      printf(" %6.2f", A[i * stride + j]);
    }
    printf(" = %6.2f", b[i]);
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b8 <dump_system+0xa8>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1181 <dump_system+0x71>
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe96(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1143 <dump_system+0x33>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe6b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1130 <dump_system+0x20>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_system>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,0x10(%rsp)
mov    %edx,0x4(%rsp)
test   %esi,%esi
jle    11cb <dump_system+0xab>
mov    %rdi,%rbx
movslq %ecx,%r13
mov    %esi,%eax
mov    %rax,0x8(%rsp)
mov    0x4(%rsp),%r14d
shl    $0x3,%r13
xor    %r15d,%r15d
lea    0xea3(%rip),%rbp
jmp    11a1 <dump_system+0x81>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rax
movsd  (%rax,%r15,8),%xmm0
lea    0xe7e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15
add    %r13,%rbx
cmp    0x8(%rsp),%r15
je     11cb <dump_system+0xab>
cmpl   $0x0,0x4(%rsp)
jle    1170 <dump_system+0x50>
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%r12,8),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %r12,%r14
jne    11b0 <dump_system+0x90>
jmp    1170 <dump_system+0x50>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c" %6.2f\00"
@.str.1 = [9 x i8] c" = %6.2f\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @dump_system(double* %0, i32 %1, i32 %2, i32 %3, double* %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
store double* %0, double** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store double* %4, double** %10
store i32 0, i32* %11
br label %13
13: ; preds = %44, %5
%14 = load i32, i32* %11
%15 = load i32, i32* %7
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %47
17: ; preds = %13
store i32 0, i32* %12
br label %18
18: ; preds = %33, %17
%19 = load i32, i32* %12
%20 = load i32, i32* %8
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %36
22: ; preds = %18
%23 = load double*, double** %6
%24 = load i32, i32* %11
%25 = load i32, i32* %9
%26 = mul nsw i32 %24, %25
%27 = load i32, i32* %12
%28 = add nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %23, i64 %29
%31 = load double, double* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %31)
br label %33
33: ; preds = %22
%34 = load i32, i32* %12
%35 = add nsw i32 %34, 1
store i32 %35, i32* %12
br label %18
36: ; preds = %18
%37 = load double*, double** %10
%38 = load i32, i32* %11
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %36
%45 = load i32, i32* %11
%46 = add nsw i32 %45, 1
store i32 %46, i32* %11
br label %13
47: ; preds = %13
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c" %6.2f\00"
@.str.1 = [9 x i8] c" = %6.2f\00"
define void @dump_system(double* nocapture %0, i32 %1, i32 %2, i32 %3, double* nocapture %4) {
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %31
7: ; preds = %5
%8 = icmp sgt i32 %2, 0
%9 = sext i32 %3 to i64
%10 = zext i32 %1 to i64
%11 = zext i32 %2 to i64
br label %12
12: ; preds = %7, %24
%13 = phi i64 [ 0, %7 ], [ %29, %24 ]
br i1 %8, label %14, label %24
14: ; preds = %12
%15 = mul nsw i64 %13, %9
br label %16
16: ; preds = %14, %16
%17 = phi i64 [ 0, %14 ], [ %22, %16 ]
%18 = add nsw i64 %17, %15
%19 = getelementptr inbounds double, double* %0, i64 %18
%20 = load double, double* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %20)
%22 = add nuw nsw i64 %17, 1
%23 = icmp eq i64 %22, %11
br i1 %23, label %24, label %16
24: ; preds = %16, %12
%25 = getelementptr inbounds double, double* %4, i64 %13
%26 = load double, double* %25
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %26)
%28 = tail call i32 @putchar(i32 10)
%29 = add nuw nsw i64 %13, 1
%30 = icmp eq i64 %29, %10
br i1 %30, label %31, label %12
31: ; preds = %24, %5
%32 = tail call i32 @putchar(i32 10)
ret void
}