#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 permutacao(int **, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int mat[100][100], i, j, l, c, per;
  printf("digite valor para linha: ");
  scanf("%d", &l);
  printf("difite valor para coluna: ");
  scanf("%d", &c);
  for (i = 0; i < l; i++) {
    for (j = 0; j < c; j++) {
      scanf("%d", &mat[i][j]);
    }
  }
  per = permutacao(mat, l, c);
  if (per == 1) {
    printf("É permutação");
  } else {
    printf("não é permutação");
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x9c5c(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
lea    -0x9c60(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x9c54(%rbp)
mov    -0x9c54(%rbp),%eax
cmp    -0x9c5c(%rbp),%eax
jge    121e <main+0xee>
movl   $0x0,-0x9c58(%rbp)
mov    -0x9c58(%rbp),%eax
cmp    -0x9c60(%rbp),%eax
jge    1205 <main+0xd5>
movslq -0x9c54(%rbp),%rax
lea    -0x9c50(%rbp),%rsi
imul   $0x190,%rax,%rax
add    %rax,%rsi
movslq -0x9c58(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe2e(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x9c58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c58(%rbp)
jmp    11ad <main+0x7d>
jmp    120a <main+0xda>
mov    -0x9c54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c54(%rbp)
jmp    1191 <main+0x61>
lea    -0x9c50(%rbp),%rdi
mov    -0x9c5c(%rbp),%esi
mov    -0x9c60(%rbp),%edx
call   1050 <permutacao@plt>
mov    %eax,-0x9c64(%rbp)
cmpl   $0x1,-0x9c64(%rbp)
jne    125a <main+0x12a>
lea    0xde8(%rip),%rdi
call   1030 <printf@plt>
jmp    1266 <main+0x136>
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
lea    0xdf0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x9c70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x9c50,%rsp
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb7(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
test   %esi,%esi
jle    11f3 <main+0xb3>
lea    0x10(%rsp),%r15
xor    %r12d,%r12d
lea    0xe76(%rip),%r14
jmp    11c3 <main+0x83>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r12
movslq %esi,%rax
add    $0x190,%r15
cmp    %rax,%r12
jge    11f3 <main+0xb3>
test   %edx,%edx
jle    11b0 <main+0x70>
mov    %r15,%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rdx
add    $0x4,%r13
cmp    %rdx,%rbx
jl     11d0 <main+0x90>
mov    0xc(%rsp),%esi
jmp    11b0 <main+0x70>
lea    0x10(%rsp),%rdi
call   1060 <permutacao@plt>
cmp    $0x1,%eax
lea    0xe31(%rip),%rax
lea    0xe3a(%rip),%rdi
cmove  %rax,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x9c50,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"digite valor para linha: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"difite valor para coluna: \00"
@.str.3 = [16 x i8] c"\C3\89 permuta\C3\A7\C3\A3o\00"
@.str.4 = [21 x i8] c"n\C3\A3o \C3\A9 permuta\C3\A7\C3\A3o\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x [100 x i32]]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%14 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
store i32 0, i32* %7
br label %16
16: ; preds = %37, %2
%17 = load i32, i32* %7
%18 = load i32, i32* %9
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %40
20: ; preds = %16
store i32 0, i32* %8
br label %21
21: ; preds = %33, %20
%22 = load i32, i32* %8
%23 = load i32, i32* %10
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %36
25: ; preds = %21
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %6, i64 0, i64 %27
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %28, i64 0, i64 %30
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %31)
br label %33
33: ; preds = %25
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %21
36: ; preds = %21
br label %37
37: ; preds = %36
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %16
40: ; preds = %16
%41 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %6, i64 0, i64 0
%42 = bitcast [100 x i32]* %41 to i32**
%43 = load i32, i32* %9
%44 = load i32, i32* %10
%45 = call i32 @permutacao(i32** %42, i32 %43, i32 %44)
store i32 %45, i32* %11
%46 = load i32, i32* %11
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %50
48: ; preds = %40
%49 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %52
50: ; preds = %40
%51 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
%53 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"digite valor para linha: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"difite valor para coluna: \00"
@.str.3 = [16 x i8] c"\C3\89 permuta\C3\A7\C3\A3o\00"
@.str.4 = [21 x i8] c"n\C3\A3o \C3\A9 permuta\C3\A7\C3\A3o\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x [100 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [100 x [100 x i32]]* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 0
%15 = load i32, i32* %5
br i1 %14, label %16, label %37
16: ; preds = %2, %31
%17 = phi i32 [ %32, %31 ], [ %13, %2 ]
%18 = phi i32 [ %33, %31 ], [ %15, %2 ]
%19 = phi i64 [ %34, %31 ], [ 0, %2 ]
%20 = icmp sgt i32 %18, 0
br i1 %20, label %21, label %31
21: ; preds = %16, %21
%22 = phi i64 [ %25, %21 ], [ 0, %16 ]
%23 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %3, i64 0, i64 %19, i64 %22
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %23)
%25 = add nuw nsw i64 %22, 1
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %25, %27
br i1 %28, label %21, label %29
29: ; preds = %21
%30 = load i32, i32* %4
br label %31
31: ; preds = %29, %16
%32 = phi i32 [ %30, %29 ], [ %17, %16 ]
%33 = phi i32 [ %26, %29 ], [ %18, %16 ]
%34 = add nuw nsw i64 %19, 1
%35 = sext i32 %32 to i64
%36 = icmp slt i64 %34, %35
br i1 %36, label %16, label %37
37: ; preds = %31, %2
%38 = phi i32 [ %15, %2 ], [ %33, %31 ]
%39 = phi i32 [ %13, %2 ], [ %32, %31 ]
%40 = bitcast [100 x [100 x i32]]* %3 to i32**
%41 = call i32 @permutacao(i32** %40, i32 %39, i32 %38)
%42 = icmp eq i32 %41, 1
%43 = select i1 %42, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0)
%44 = call i32 @printf(i8* dereferenceable(1) %43)
%45 = call i32 @putchar(i32 10)
ret i32 0
}