#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*/ printf(char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ test_cycle(int, int);
int /*<<< orphan*/ test_square_transpose(int);
int /*<<< orphan*/ test_transpose(int, int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int i, j;
  srand(time(NULL));
  printf("# Test Cycle\n");
  for (i = 1; i <= 100; i++)
    test_cycle(i, i);
  test_cycle(2, 3);
  test_cycle(4, 39);
  test_cycle(54, 100);
  test_cycle(320, 30);
  printf("\n");
  printf("# Test Transpose\n");
  for (i = 0; i <= 4; i++)
    for (j = 0; j <= 4; j++)
      test_transpose(i, j, 5);
  printf("# Test Square Transpose\n");
  for (i = 1; i <= 100; i++)
    test_square_transpose(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     11b5 <main+0x55>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <test_cycle@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1192 <main+0x32>
mov    $0x2,%edi
mov    $0x3,%esi
call   1070 <test_cycle@plt>
mov    $0x4,%edi
mov    $0x27,%esi
call   1070 <test_cycle@plt>
mov    $0x36,%edi
mov    $0x64,%esi
call   1070 <test_cycle@plt>
mov    $0x140,%edi
mov    $0x1e,%esi
call   1070 <test_cycle@plt>
lea    0xe14(%rip),%rdi
call   1040 <printf@plt>
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     125c <main+0xfc>
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jg     1249 <main+0xe9>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x5,%edx
call   1080 <test_transpose@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1221 <main+0xc1>
jmp    124e <main+0xee>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1210 <main+0xb0>
lea    0xdbd(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     128f <main+0x12f>
mov    -0x8(%rbp),%edi
call   1030 <test_square_transpose@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    126f <main+0x10f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
lea    0xe7a(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%edi
mov    %ebx,%esi
call   1080 <test_cycle@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1190 <main+0x20>
mov    $0x2,%edi
mov    $0x3,%esi
call   1080 <test_cycle@plt>
mov    $0x4,%edi
mov    $0x27,%esi
call   1080 <test_cycle@plt>
mov    $0x36,%edi
mov    $0x64,%esi
call   1080 <test_cycle@plt>
mov    $0x140,%edi
mov    $0x1e,%esi
call   1080 <test_cycle@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe1f(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x1,%ebx
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
xor    %edi,%edi
mov    $0x2,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
xor    %edi,%edi
mov    $0x3,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
xor    %edi,%edi
mov    $0x4,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x1,%edi
mov    $0x3,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x1,%edi
mov    $0x4,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x2,%edi
xor    %esi,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x2,%edi
mov    $0x2,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x2,%edi
mov    $0x3,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x2,%edi
mov    $0x4,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x3,%edi
xor    %esi,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x3,%edi
mov    $0x1,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x3,%edi
mov    $0x3,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x3,%edi
mov    $0x4,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x4,%edi
xor    %esi,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x4,%edi
mov    $0x1,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x4,%edi
mov    $0x2,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x4,%edi
mov    $0x3,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
mov    $0x4,%edi
mov    $0x4,%esi
mov    $0x5,%edx
call   1090 <test_transpose@plt>
lea    0xc49(%rip),%rdi
call   1040 <puts@plt>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1050 <test_square_transpose@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    13e0 <main+0x270>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"# Test Cycle\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [18 x i8] c"# Test Transpose\0A\00"
@.str.3 = [25 x i8] c"# Test Square Transpose\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 100
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %2
%12 = load i32, i32* %2
%13 = call i32 @test_cycle(i32 %11, i32 %12)
br label %14
14: ; preds = %10
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %7
17: ; preds = %7
%18 = call i32 @test_cycle(i32 2, i32 3)
%19 = call i32 @test_cycle(i32 4, i32 39)
%20 = call i32 @test_cycle(i32 54, i32 100)
%21 = call i32 @test_cycle(i32 320, i32 30)
%22 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %24
24: ; preds = %39, %17
%25 = load i32, i32* %2
%26 = icmp sle i32 %25, 4
br i1 %26, label %27, label %42
27: ; preds = %24
store i32 0, i32* %3
br label %28
28: ; preds = %35, %27
%29 = load i32, i32* %3
%30 = icmp sle i32 %29, 4
br i1 %30, label %31, label %38
31: ; preds = %28
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = call i32 @test_transpose(i32 %32, i32 %33, i32 5)
br label %35
35: ; preds = %31
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %28
38: ; preds = %28
br label %39
39: ; preds = %38
%40 = load i32, i32* %2
%41 = add nsw i32 %40, 1
store i32 %41, i32* %2
br label %24
42: ; preds = %24
%43 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %2
br label %44
44: ; preds = %50, %42
%45 = load i32, i32* %2
%46 = icmp sle i32 %45, 100
br i1 %46, label %47, label %53
47: ; preds = %44
%48 = load i32, i32* %2
%49 = call i32 @test_square_transpose(i32 %48)
br label %50
50: ; preds = %47
%51 = load i32, i32* %2
%52 = add nsw i32 %51, 1
store i32 %52, i32* %2
br label %44
53: ; preds = %44
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"# Test Cycle\00"
@str.4 = [17 x i8] c"# Test Transpose\00"
@str.5 = [24 x i8] c"# Test Square Transpose\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %0, %4
%5 = phi i32 [ 1, %0 ], [ %7, %4 ]
%6 = tail call i32 @test_cycle(i32 %5, i32 %5)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, 101
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = tail call i32 @test_cycle(i32 2, i32 3)
%11 = tail call i32 @test_cycle(i32 4, i32 39)
%12 = tail call i32 @test_cycle(i32 54, i32 100)
%13 = tail call i32 @test_cycle(i32 320, i32 30)
%14 = tail call i32 @putchar(i32 10)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0))
%16 = tail call i32 @test_transpose(i32 0, i32 0, i32 5)
%17 = tail call i32 @test_transpose(i32 0, i32 1, i32 5)
%18 = tail call i32 @test_transpose(i32 0, i32 2, i32 5)
%19 = tail call i32 @test_transpose(i32 0, i32 3, i32 5)
%20 = tail call i32 @test_transpose(i32 0, i32 4, i32 5)
%21 = tail call i32 @test_transpose(i32 1, i32 0, i32 5)
%22 = tail call i32 @test_transpose(i32 1, i32 1, i32 5)
%23 = tail call i32 @test_transpose(i32 1, i32 2, i32 5)
%24 = tail call i32 @test_transpose(i32 1, i32 3, i32 5)
%25 = tail call i32 @test_transpose(i32 1, i32 4, i32 5)
%26 = tail call i32 @test_transpose(i32 2, i32 0, i32 5)
%27 = tail call i32 @test_transpose(i32 2, i32 1, i32 5)
%28 = tail call i32 @test_transpose(i32 2, i32 2, i32 5)
%29 = tail call i32 @test_transpose(i32 2, i32 3, i32 5)
%30 = tail call i32 @test_transpose(i32 2, i32 4, i32 5)
%31 = tail call i32 @test_transpose(i32 3, i32 0, i32 5)
%32 = tail call i32 @test_transpose(i32 3, i32 1, i32 5)
%33 = tail call i32 @test_transpose(i32 3, i32 2, i32 5)
%34 = tail call i32 @test_transpose(i32 3, i32 3, i32 5)
%35 = tail call i32 @test_transpose(i32 3, i32 4, i32 5)
%36 = tail call i32 @test_transpose(i32 4, i32 0, i32 5)
%37 = tail call i32 @test_transpose(i32 4, i32 1, i32 5)
%38 = tail call i32 @test_transpose(i32 4, i32 2, i32 5)
%39 = tail call i32 @test_transpose(i32 4, i32 3, i32 5)
%40 = tail call i32 @test_transpose(i32 4, i32 4, i32 5)
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.5, i64 0, i64 0))
br label %42
42: ; preds = %9, %42
%43 = phi i32 [ 1, %9 ], [ %45, %42 ]
%44 = tail call i32 @test_square_transpose(i32 %43)
%45 = add nuw nsw i32 %43, 1
%46 = icmp eq i32 %45, 101
br i1 %46, label %47, label %42
47: ; preds = %42
ret i32 0
}