#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*/ rotate(int **, int, int);
int /*<<< orphan*/ scanf(char *, int *);
void run_rotate(void) {
  int a[2][3], i, j;
  for (i = 0; i < 2; ++i) {
    for (j = 0; j < 3; ++j) {
      scanf("%d,", &a[i][j]);
    }
  }
  rotate(a, 2, 3);
}


x86 assembly (clang, -O0):
<run_rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    1191 <run_rotate+0x71>
movl   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jge    117e <run_rotate+0x5e>
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rsi
imul   $0xc,%rax,%rax
add    %rax,%rsi
movslq -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe95(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1140 <run_rotate+0x20>
jmp    1183 <run_rotate+0x63>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <run_rotate+0xf>
lea    -0x20(%rbp),%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <rotate@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_rotate>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed2(%rip),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <rotate@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d,\00"
define void @run_rotate() {
%1 = alloca [2 x [3 x i32]]
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %2
br label %4
4: ; preds = %23, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 2
br i1 %6, label %7, label %26
7: ; preds = %4
store i32 0, i32* %3
br label %8
8: ; preds = %19, %7
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %1, i64 0, i64 %13
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %14, i64 0, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %17)
br label %19
19: ; preds = %11
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %8
22: ; preds = %8
br label %23
23: ; preds = %22
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %4
26: ; preds = %4
%27 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %1, i64 0, i64 0
%28 = bitcast [3 x i32]* %27 to i32**
%29 = call i32 @rotate(i32** %28, i32 2, i32 3)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d,\00"
define void @run_rotate() {
%1 = alloca [2 x [3 x i32]]
%2 = bitcast [2 x [3 x i32]]* %1 to i8*
%3 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %1, i64 0, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %1, i64 0, i64 0, i64 1
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %1, i64 0, i64 0, i64 2
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %7)
%9 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %1, i64 0, i64 1, i64 0
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %1, i64 0, i64 1, i64 1
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = getelementptr inbounds [2 x [3 x i32]], [2 x [3 x i32]]* %1, i64 0, i64 1, i64 2
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %13)
%15 = bitcast [2 x [3 x i32]]* %1 to i32**
%16 = call i32 @rotate(i32** %15, i32 2, i32 3)
ret void
}