#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 atoi(char *);
int /*<<< orphan*/ get_identity(int, int, int **);
int /*<<< orphan*/ print_sandpile(int, int, int **);
int main(int argc, char *argv[]) {
  int rows = atoi(argv[1]), cols = atoi(argv[2]);
  int sandpile[rows][cols];
  get_identity(rows, cols, sandpile);
  print_sandpile(rows, cols, sandpile);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,%rdx
imul   %rax,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x38(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <get_identity@plt>
mov    -0x38(%rbp),%rdx
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <print_sandpile@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1040 <atoi@plt>
mov    %eax,%r15d
mov    %r14d,%eax
mov    %r15d,%ecx
imul   %rax,%rcx
lea    0xf(,%rcx,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %r14d,%edi
mov    %r15d,%esi
mov    %rbx,%rdx
call   1050 <get_identity@plt>
mov    %r14d,%edi
mov    %r15d,%esi
mov    %rbx,%rdx
call   1030 <print_sandpile@plt>
xor    %eax,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
store i32 %14, i32* %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %7
%19 = load i32, i32* %6
%20 = zext i32 %19 to i64
%21 = load i32, i32* %7
%22 = zext i32 %21 to i64
%23 = call i8* @llvm.stacksave()
store i8* %23, i8** %8
%24 = mul nuw i64 %20, %22
%25 = alloca i32, i64 %24
store i64 %20, i64* %9
store i64 %22, i64* %10
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = bitcast i32* %25 to i32**
%29 = call i32 @get_identity(i32 %26, i32 %27, i32** %28)
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = bitcast i32* %25 to i32**
%33 = call i32 @print_sandpile(i32 %30, i32 %31, i32** %32)
store i32 0, i32* %3
%34 = load i8*, i8** %8
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = zext i32 %5 to i64
%10 = zext i32 %8 to i64
%11 = mul nuw i64 %10, %9
%12 = alloca i32, i64 %11
%13 = bitcast i32* %12 to i32**
%14 = call i32 @get_identity(i32 %5, i32 %8, i32** %13)
%15 = call i32 @print_sandpile(i32 %5, i32 %8, i32** %13)
ret i32 0
}