#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 INT_MIN;
int /*<<< orphan*/ swap(int *, int *);
int transpose(int arr[][10], int l, int b) {
  int max = INT_MIN;
  for (int i = 0; i < l; i++) {
    for (int j = 0; j < b; j++) {
      if (i > j) {
        swap(&arr[i][j], &arr[j][i]);
      }
    }
  }
  return max;
}


x86 assembly (clang, -O0):
<transpose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2ebf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bf <transpose+0xaf>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ac <transpose+0x9c>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    1199 <transpose+0x89>
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
imul   $0x28,%rax,%rax
add    %rax,%rdi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
imul   $0x28,%rax,%rax
add    %rax,%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
call   1030 <swap@plt>
jmp    119e <transpose+0x8e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1148 <transpose+0x38>
jmp    11b1 <transpose+0xa1>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1135 <transpose+0x25>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transpose>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,0xc(%rsp)
mov    %rdi,0x10(%rsp)
mov    0x2eba(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
test   %esi,%esi
jle    11a3 <transpose+0x93>
mov    %esi,%eax
mov    %rax,0x20(%rsp)
mov    0xc(%rsp),%r14d
xor    %r15d,%r15d
mov    0x10(%rsp),%r12
jmp    1165 <transpose+0x55>
xchg   %ax,%ax
add    $0x1,%r15
add    $0x28,%r12
addq   $0x4,0x10(%rsp)
cmp    0x20(%rsp),%r15
je     11a3 <transpose+0x93>
cmpl   $0x0,0xc(%rsp)
jle    1150 <transpose+0x40>
mov    0x10(%rsp),%rbx
mov    %r12,%rbp
xor    %r13d,%r13d
jmp    1191 <transpose+0x81>
nopl   0x0(%rax)
add    $0x1,%r13
add    $0x4,%rbp
add    $0x28,%rbx
cmp    %r13,%r14
je     1150 <transpose+0x40>
cmp    %r13,%r15
jbe    1180 <transpose+0x70>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <swap@plt>
jmp    1180 <transpose+0x70>
mov    0x1c(%rsp),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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