#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 *, float);
int /*<<< orphan*/ sgesv_(int *, int *, float *, int *, int *, float *, int *,
                          int *);
int main() {
  int i, j, c1, c2, pivot[3], ok;
  float A[3][3], b[3], AT[3 * 3];
  A[0][0] = 3.1;
  A[0][1] = 1.3;
  A[0][2] = -5.7;
  A[1][0] = 1.0;
  A[1][1] = -6.9;
  A[1][2] = 5.8;
  A[2][0] = 3.4;
  A[2][1] = 7.2;
  A[2][2] = -8.8;
  b[0] = -1.3;
  b[1] = -0.1;
  b[2] = 1.8;
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++)
      AT[j + 3 * i] = A[j][i];
  }
  c1 = 3;
  c2 = 1;
  sgesv_(&c1, &c2, AT, &c1, pivot, b, &c1, &ok);
  for (j = 0; j < 3; j++)
    printf("%e\n", b[j]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xef2(%rip),%xmm0
movss  %xmm0,-0x50(%rbp)
movss  0xee1(%rip),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  0xed0(%rip),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  0xebf(%rip),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  0xeae(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  0xe9d(%rip),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  0xe8c(%rip),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  0xe7b(%rip),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  0xe6a(%rip),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  0xe59(%rip),%xmm0
movss  %xmm0,-0x5c(%rbp)
movss  0xe48(%rip),%xmm0
movss  %xmm0,-0x58(%rbp)
movss  0xe37(%rip),%xmm0
movss  %xmm0,-0x54(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    123a <main+0x11a>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1227 <main+0x107>
movslq -0xc(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0xc(%rbp),%eax
imul   $0x3,-0x8(%rbp),%ecx
add    %ecx,%eax
cltq
movss  %xmm0,-0x80(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11e6 <main+0xc6>
jmp    122c <main+0x10c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d5 <main+0xb5>
movl   $0x3,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    -0x80(%rbp),%rdx
lea    -0x20(%rbp),%r8
lea    -0x5c(%rbp),%r9
lea    -0x10(%rbp),%r10
lea    -0x14(%rbp),%rsi
lea    -0x24(%rbp),%rax
mov    %r10,%rdi
mov    %r10,%rcx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <sgesv_@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    12a9 <main+0x189>
movslq -0xc(%rbp),%rax
movss  -0x5c(%rbp,%rax,4),%xmm0
lea    0xd9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    127b <main+0x15b>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
movabs $0xbdcccccdbfa66666,%rax
cc cc bd
mov    %rax,0x8(%rsp)
movl   $0x3fe66666,0x10(%rsp)
3f
movaps 0xebd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movl   $0xc10ccccd,0x40(%rsp)
c1
movl   $0x3,0x18(%rsp)
movl   $0x1,0x14(%rsp)
lea    0x1c(%rsp),%rax
lea    0x18(%rsp),%rcx
lea    0x14(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x44(%rsp),%r8
lea    0x8(%rsp),%r9
mov    %rcx,%rdi
push   %rax
push   %rcx
call   1040 <sgesv_@plt>
add    $0x10,%rsp
movss  0x8(%rsp),%xmm0
lea    0xe7b(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [3 x i32]
%7 = alloca i32
%8 = alloca [3 x [3 x float]]
%9 = alloca [3 x float]
%10 = alloca [9 x float]
store i32 0, i32* %1
%11 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %8, i64 0, i64 0
%12 = getelementptr inbounds [3 x float], [3 x float]* %11, i64 0, i64 0
store float 0x4008CCCCC0000000, float* %12
%13 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %8, i64 0, i64 0
%14 = getelementptr inbounds [3 x float], [3 x float]* %13, i64 0, i64 1
store float 0x3FF4CCCCC0000000, float* %14
%15 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %8, i64 0, i64 0
%16 = getelementptr inbounds [3 x float], [3 x float]* %15, i64 0, i64 2
store float 0xC016CCCCC0000000, float* %16
%17 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %8, i64 0, i64 1
%18 = getelementptr inbounds [3 x float], [3 x float]* %17, i64 0, i64 0
store float 1.000000e+00, float* %18
%19 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %8, i64 0, i64 1
%20 = getelementptr inbounds [3 x float], [3 x float]* %19, i64 0, i64 1
store float 0xC01B9999A0000000, float* %20
%21 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %8, i64 0, i64 1
%22 = getelementptr inbounds [3 x float], [3 x float]* %21, i64 0, i64 2
store float 0x4017333340000000, float* %22
%23 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %8, i64 0, i64 2
%24 = getelementptr inbounds [3 x float], [3 x float]* %23, i64 0, i64 0
store float 0x400B333340000000, float* %24
%25 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %8, i64 0, i64 2
%26 = getelementptr inbounds [3 x float], [3 x float]* %25, i64 0, i64 1
store float 0x401CCCCCC0000000, float* %26
%27 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %8, i64 0, i64 2
%28 = getelementptr inbounds [3 x float], [3 x float]* %27, i64 0, i64 2
store float 0xC0219999A0000000, float* %28
%29 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
store float 0xBFF4CCCCC0000000, float* %29
%30 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 1
store float 0xBFB99999A0000000, float* %30
%31 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 2
store float 0x3FFCCCCCC0000000, float* %31
store i32 0, i32* %2
br label %32
32: ; preds = %57, %0
%33 = load i32, i32* %2
%34 = icmp slt i32 %33, 3
br i1 %34, label %35, label %60
35: ; preds = %32
store i32 0, i32* %3
br label %36
36: ; preds = %53, %35
%37 = load i32, i32* %3
%38 = icmp slt i32 %37, 3
br i1 %38, label %39, label %56
39: ; preds = %36
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %8, i64 0, i64 %41
%43 = load i32, i32* %2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [3 x float], [3 x float]* %42, i64 0, i64 %44
%46 = load float, float* %45
%47 = load i32, i32* %3
%48 = load i32, i32* %2
%49 = mul nsw i32 3, %48
%50 = add nsw i32 %47, %49
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [9 x float], [9 x float]* %10, i64 0, i64 %51
store float %46, float* %52
br label %53
53: ; preds = %39
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
br label %36
56: ; preds = %36
br label %57
57: ; preds = %56
%58 = load i32, i32* %2
%59 = add nsw i32 %58, 1
store i32 %59, i32* %2
br label %32
60: ; preds = %32
store i32 3, i32* %4
store i32 1, i32* %5
%61 = getelementptr inbounds [9 x float], [9 x float]* %10, i64 0, i64 0
%62 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%63 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%64 = call i32 @sgesv_(i32* %4, i32* %5, float* %61, i32* %4, i32* %62, float* %63, i32* %4, i32* %7)
store i32 0, i32* %3
br label %65
65: ; preds = %74, %60
%66 = load i32, i32* %3
%67 = icmp slt i32 %66, 3
br i1 %67, label %68, label %77
68: ; preds = %65
%69 = load i32, i32* %3
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 %70
%72 = load float, float* %71
%73 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %72)
br label %74
74: ; preds = %68
%75 = load i32, i32* %3
%76 = add nsw i32 %75, 1
store i32 %76, i32* %3
br label %65
77: ; preds = %65
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i32]
%4 = alloca i32
%5 = alloca [3 x float]
%6 = alloca [9 x float]
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast [3 x i32]* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast [3 x float]* %5 to i8*
%12 = bitcast [9 x float]* %6 to i8*
%13 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
store float 0xBFF4CCCCC0000000, float* %13
%14 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
store float 0xBFB99999A0000000, float* %14
%15 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 2
store float 0x3FFCCCCCC0000000, float* %15
%16 = getelementptr inbounds [9 x float], [9 x float]* %6, i64 0, i64 0
%17 = bitcast [9 x float]* %6 to <4 x float>*
store <4 x float> <float 0x4008CCCCC0000000, float 1.000000e+00, float 0x400B333340000000, float 0x3FF4CCCCC0000000>, <4 x float>* %17
%18 = getelementptr inbounds [9 x float], [9 x float]* %6, i64 0, i64 4
%19 = bitcast float* %18 to <4 x float>*
store <4 x float> <float 0xC01B9999A0000000, float 0x401CCCCCC0000000, float 0xC016CCCCC0000000, float 0x4017333340000000>, <4 x float>* %19
%20 = getelementptr inbounds [9 x float], [9 x float]* %6, i64 0, i64 8
store float 0xC0219999A0000000, float* %20
store i32 3, i32* %1
store i32 1, i32* %2
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%22 = call i32 @sgesv_(i32* %1, i32* %2, float* %16, i32* %1, i32* %21, float* %13, i32* %1, i32* %4)
%23 = load float, float* %13
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %23)
%25 = load float, float* %14
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %25)
%27 = load float, float* %15
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %27)
ret i32 0
}