#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 backrow(int, double **, double *, int /*<<< orphan*/);
int /*<<< orphan*/ forwrowunitario(int, double **, double *);
int /*<<< orphan*/ swap(double *, double *);
int ssrow(int n, double A[][800], int p[], double b[]) {
  int i;
  for (i = 0; i < n; i++) {
    swap(&b[i], &b[p[i]]);
  }
  forwrowunitario(n, A, b);
  if (backrow(n, A, b, 0) == -1)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<ssrow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1193 <ssrow+0x63>
mov    -0x20(%rbp),%rdi
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movslq (%rax,%rcx,4),%rax
shl    $0x3,%rax
add    %rax,%rsi
call   1050 <swap@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114e <ssrow+0x1e>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <forwrowunitario@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <backrow@plt>
cmp    $0xffffffff,%eax
jne    11ca <ssrow+0x9a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d1 <ssrow+0xa1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssrow>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r12
mov    %rsi,(%rsp)
mov    %edi,%r15d
test   %edi,%edi
jle    117e <ssrow+0x4e>
mov    %rdx,%r13
mov    %r15d,%ebp
xor    %r14d,%r14d
mov    %r12,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movslq 0x0(%r13,%r14,4),%rax
lea    (%r12,%rax,8),%rsi
mov    %rbx,%rdi
call   1050 <swap@plt>
add    $0x1,%r14
add    $0x8,%rbx
cmp    %r14,%rbp
jne    1160 <ssrow+0x30>
mov    %r15d,%edi
mov    (%rsp),%rbx
mov    %rbx,%rsi
mov    %r12,%rdx
call   1040 <forwrowunitario@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
xor    %ecx,%ecx
call   1030 <backrow@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
sete   %cl
neg    %ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ssrow(i32 %0, [800 x double]* %1, i32* %2, double* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca [800 x double]*
%8 = alloca i32*
%9 = alloca double*
%10 = alloca i32
store i32 %0, i32* %6
store [800 x double]* %1, [800 x double]** %7
store i32* %2, i32** %8
store double* %3, double** %9
store i32 0, i32* %10
br label %11
11: ; preds = %29, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %32
15: ; preds = %11
%16 = load double*, double** %9
%17 = load i32, i32* %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double*, double** %9
%21 = load i32*, i32** %8
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %20, i64 %26
%28 = call i32 @swap(double* %19, double* %27)
br label %29
29: ; preds = %15
%30 = load i32, i32* %10
%31 = add nsw i32 %30, 1
store i32 %31, i32* %10
br label %11
32: ; preds = %11
%33 = load i32, i32* %6
%34 = load [800 x double]*, [800 x double]** %7
%35 = bitcast [800 x double]* %34 to double**
%36 = load double*, double** %9
%37 = call i32 @forwrowunitario(i32 %33, double** %35, double* %36)
%38 = load i32, i32* %6
%39 = load [800 x double]*, [800 x double]** %7
%40 = bitcast [800 x double]* %39 to double**
%41 = load double*, double** %9
%42 = call i32 @backrow(i32 %38, double** %40, double* %41, i32 0)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %45
44: ; preds = %32
store i32 -1, i32* %5
br label %46
45: ; preds = %32
store i32 0, i32* %5
br label %46
46: ; preds = %45, %44
%47 = load i32, i32* %5
ret i32 %47
}

LLVM IR (-O2):
define i32 @ssrow(i32 %0, [800 x double]* %1, i32* nocapture %2, double* %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %18
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %16, %8 ]
%10 = getelementptr inbounds double, double* %3, i64 %9
%11 = getelementptr inbounds i32, i32* %2, i64 %9
%12 = load i32, i32* %11
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %3, i64 %13
%15 = tail call i32 @swap(double* %10, double* %14)
%16 = add nuw nsw i64 %9, 1
%17 = icmp eq i64 %16, %7
br i1 %17, label %18, label %8
18: ; preds = %8, %4
%19 = bitcast [800 x double]* %1 to double**
%20 = tail call i32 @forwrowunitario(i32 %0, double** %19, double* %3)
%21 = tail call i32 @backrow(i32 %0, double** %19, double* %3, i32 0)
%22 = icmp eq i32 %21, -1
%23 = sext i1 %22 to i32
ret i32 %23
}