#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*/ change(int *, int *);
void troca(int i, int j, int m, int n, int matriz[100][100]) {
  int b;
  for (b = 0; b < n; b++) {
    change(&matriz[i][b], &matriz[j][b]);
  }
}


x86 assembly (clang, -O0):
<troca>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1188 <troca+0x78>
mov    -0x18(%rbp),%rdi
movslq -0x4(%rbp),%rax
imul   $0x190,%rax,%rax
add    %rax,%rdi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
movslq -0x8(%rbp),%rax
imul   $0x190,%rax,%rax
add    %rax,%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
call   1030 <change@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112f <troca+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<troca>:
push   %r15
push   %r14
push   %rbx
test   %ecx,%ecx
jle    1159 <troca+0x49>
movslq %edi,%rax
movslq %esi,%rdx
mov    %ecx,%r15d
imul   $0x190,%rdx,%r14
add    %r8,%r14
imul   $0x190,%rax,%rbx
add    %r8,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <change@plt>
add    $0x4,%r14
add    $0x4,%rbx
add    $0xffffffffffffffff,%r15
jne    1140 <troca+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @troca(i32 %0, i32 %1, i32 %2, i32 %3, [100 x i32]* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [100 x i32]*
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store [100 x i32]* %4, [100 x i32]** %10
store i32 0, i32* %11
br label %12
12: ; preds = %32, %5
%13 = load i32, i32* %11
%14 = load i32, i32* %9
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %35
16: ; preds = %12
%17 = load [100 x i32]*, [100 x i32]** %10
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %17, i64 %19
%21 = load i32, i32* %11
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %20, i64 0, i64 %22
%24 = load [100 x i32]*, [100 x i32]** %10
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [100 x i32], [100 x i32]* %24, i64 %26
%28 = load i32, i32* %11
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [100 x i32], [100 x i32]* %27, i64 0, i64 %29
%31 = call i32 @change(i32* %23, i32* %30)
br label %32
32: ; preds = %16
%33 = load i32, i32* %11
%34 = add nsw i32 %33, 1
store i32 %34, i32* %11
br label %12
35: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @troca(i32 %0, i32 %1, i32 %2, i32 %3, [100 x i32]* %4) {
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %18
7: ; preds = %5
%8 = sext i32 %0 to i64
%9 = sext i32 %1 to i64
%10 = zext i32 %3 to i64
br label %11
11: ; preds = %7, %11
%12 = phi i64 [ 0, %7 ], [ %16, %11 ]
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 %8, i64 %12
%14 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 %9, i64 %12
%15 = tail call i32 @change(i32* %13, i32* %14)
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11, %5
ret void
}