#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*/ printMatrixt(int **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ swap(int *, int *);
int main(void) {
  int matrix[10][10];
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      matrix[i][j] = j;
    }
  }
  printMatrixt(matrix);
  int t;
  for (int i = 0, j = 9; i < 10; ++i, --j) {
    swap(&matrix[i][i], &matrix[i][j]);
  }
  printf(" ------------Swap------------\n");
  printMatrixt(matrix);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
cmpl   $0xa,-0x1a4(%rbp)
jge    11c2 <main+0x92>
movl   $0x0,-0x1a8(%rbp)
cmpl   $0xa,-0x1a8(%rbp)
jge    11a9 <main+0x79>
mov    -0x1a8(%rbp),%edx
movslq -0x1a4(%rbp),%rcx
lea    -0x1a0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x1a8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    1163 <main+0x33>
jmp    11ae <main+0x7e>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    114c <main+0x1c>
lea    -0x1a0(%rbp),%rdi
call   1050 <printMatrixt@plt>
movl   $0x0,-0x1b0(%rbp)
movl   $0x9,-0x1b4(%rbp)
cmpl   $0xa,-0x1b0(%rbp)
jge    125d <main+0x12d>
movslq -0x1b0(%rbp),%rax
lea    -0x1a0(%rbp),%rdi
imul   $0x28,%rax,%rax
add    %rax,%rdi
movslq -0x1b0(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
movslq -0x1b0(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
imul   $0x28,%rax,%rax
add    %rax,%rsi
movslq -0x1b4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
call   1040 <swap@plt>
mov    -0x1b0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b0(%rbp)
mov    -0x1b4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1b4(%rbp)
jmp    11e2 <main+0xb2>
lea    0xd9c(%rip),%rdi
call   1030 <printf@plt>
lea    -0x1a0(%rbp),%rdi
call   1050 <printMatrixt@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x198,%rsp
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xebd(%rip),%xmm1
movaps %xmm1,0x10(%rsp)
movabs $0x900000008,%rax
mov    %rax,0x20(%rsp)
lea    0x24(%rsp),%r15
movups %xmm0,0x28(%rsp)
movups %xmm1,0x38(%rsp)
lea    0x48(%rsp),%r14
mov    %rax,0x48(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm1,0x60(%rsp)
mov    %rax,0x70(%rsp)
movups %xmm0,0x78(%rsp)
movups %xmm1,0x88(%rsp)
mov    %rax,0x98(%rsp)
movaps %xmm0,0xa0(%rsp)
lea    0xb0(%rsp),%rbp
movaps %xmm1,0xb0(%rsp)
mov    %rax,0xc0(%rsp)
movups %xmm0,0xc8(%rsp)
lea    0xd8(%rsp),%r13
movups %xmm1,0xd8(%rsp)
mov    %rax,0xe8(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm1,0x100(%rsp)
mov    %rax,0x110(%rsp)
movups %xmm0,0x118(%rsp)
movups %xmm1,0x128(%rsp)
mov    %rax,0x138(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm1,0x150(%rsp)
mov    %rax,0x160(%rsp)
movups %xmm0,0x168(%rsp)
movups %xmm1,0x178(%rsp)
mov    %rax,0x188(%rsp)
lea    0x18c(%rsp),%r12
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <printMatrixt@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <swap@plt>
lea    0x2c(%rsp),%rdi
mov    %r14,%rsi
call   1040 <swap@plt>
lea    0x58(%rsp),%rdi
lea    0x6c(%rsp),%rsi
call   1040 <swap@plt>
lea    0x84(%rsp),%rdi
lea    0x90(%rsp),%rsi
call   1040 <swap@plt>
lea    0xb4(%rsp),%rsi
mov    %rbp,%rdi
call   1040 <swap@plt>
lea    0xdc(%rsp),%rdi
mov    %r13,%rsi
call   1040 <swap@plt>
lea    0x108(%rsp),%rdi
lea    0xfc(%rsp),%rsi
call   1040 <swap@plt>
lea    0x134(%rsp),%rdi
lea    0x120(%rsp),%rsi
call   1040 <swap@plt>
lea    0x144(%rsp),%rsi
lea    0x160(%rsp),%rdi
call   1040 <swap@plt>
mov    %r12,%rdi
lea    0x168(%rsp),%rsi
call   1040 <swap@plt>
lea    0xd17(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <printMatrixt@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@str = [30 x i8] c" ------------Swap------------\00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = bitcast [10 x [10 x i32]]* %1 to i8*
%3 = bitcast [10 x [10 x i32]]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %3
%4 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 0, i64 4
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %5
%6 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 0, i64 8
store i32 8, i32* %6
%7 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 0, i64 9
store i32 9, i32* %7
%8 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 1, i64 0
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %9
%10 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 1, i64 4
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %11
%12 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 1, i64 8
store i32 8, i32* %12
%13 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 1, i64 9
store i32 9, i32* %13
%14 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 2, i64 0
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %15
%16 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 2, i64 4
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %17
%18 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 2, i64 8
store i32 8, i32* %18
%19 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 2, i64 9
store i32 9, i32* %19
%20 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 3, i64 0
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %21
%22 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 3, i64 4
%23 = bitcast i32* %22 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %23
%24 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 3, i64 8
store i32 8, i32* %24
%25 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 3, i64 9
store i32 9, i32* %25
%26 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 4, i64 0
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %27
%28 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 4, i64 4
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %29
%30 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 4, i64 8
store i32 8, i32* %30
%31 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 4, i64 9
store i32 9, i32* %31
%32 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 5, i64 0
%33 = bitcast i32* %32 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %33
%34 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 5, i64 4
%35 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %35
%36 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 5, i64 8
store i32 8, i32* %36
%37 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 5, i64 9
store i32 9, i32* %37
%38 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 6, i64 0
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %39
%40 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 6, i64 4
%41 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %41
%42 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 6, i64 8
store i32 8, i32* %42
%43 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 6, i64 9
store i32 9, i32* %43
%44 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 7, i64 0
%45 = bitcast i32* %44 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %45
%46 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 7, i64 4
%47 = bitcast i32* %46 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %47
%48 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 7, i64 8
store i32 8, i32* %48
%49 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 7, i64 9
store i32 9, i32* %49
%50 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 8, i64 0
%51 = bitcast i32* %50 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %51
%52 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 8, i64 4
%53 = bitcast i32* %52 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %53
%54 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 8, i64 8
store i32 8, i32* %54
%55 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 8, i64 9
store i32 9, i32* %55
%56 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 9, i64 0
%57 = bitcast i32* %56 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %57
%58 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 9, i64 4
%59 = bitcast i32* %58 to <4 x i32>*
store <4 x i32> <i32 4, i32 5, i32 6, i32 7>, <4 x i32>* %59
%60 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 9, i64 8
store i32 8, i32* %60
%61 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 9, i64 9
store i32 9, i32* %61
%62 = bitcast [10 x [10 x i32]]* %1 to i32**
%63 = call i32 @printMatrixt(i32** %62)
%64 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 0, i64 0
%65 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 0, i64 9
%66 = call i32 @swap(i32* %64, i32* %65)
%67 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 1, i64 1
%68 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 1, i64 8
%69 = call i32 @swap(i32* %67, i32* %68)
%70 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 2, i64 2
%71 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 2, i64 7
%72 = call i32 @swap(i32* %70, i32* %71)
%73 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 3, i64 3
%74 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 3, i64 6
%75 = call i32 @swap(i32* %73, i32* %74)
%76 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 4, i64 4
%77 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 4, i64 5
%78 = call i32 @swap(i32* %76, i32* %77)
%79 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 5, i64 5
%80 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 5, i64 4
%81 = call i32 @swap(i32* %79, i32* %80)
%82 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 6, i64 6
%83 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 6, i64 3
%84 = call i32 @swap(i32* %82, i32* %83)
%85 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 7, i64 7
%86 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 7, i64 2
%87 = call i32 @swap(i32* %85, i32* %86)
%88 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 8, i64 8
%89 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 8, i64 1
%90 = call i32 @swap(i32* %88, i32* %89)
%91 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 9, i64 9
%92 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 9, i64 0
%93 = call i32 @swap(i32* %91, i32* %92)
%94 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%95 = call i32 @printMatrixt(i32** %62)
ret i32 0
}