#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 */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ get_matrix_mpz(int /*<<< orphan*/, int /*<<< orphan*/ **,
                                  int, int);
int /*<<< orphan*/ gmp_printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ init_matrix_mpz(int /*<<< orphan*/ ***, int, int);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_set_str(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ set_matrix_mpz(int /*<<< orphan*/ **, int, int,
                                  int /*<<< orphan*/);
int main() {
  mpz_t **matrice;
  init_matrix_mpz(&matrice, 5, 5);
  unsigned int ui;
  mpz_t mp;
  mpz_init(mp);
  mpz_set_str(mp, "258584478548548754825896954865781478158", 10);
  printf("Sto per settare l'mpz\n");
  set_matrix_mpz(matrice, 2, 2, mp);
  mpz_t val;
  mpz_init(val);
  printf("Sto per leggere l'mpz\n");
  get_matrix_mpz(val, matrice, 2, 2);
  gmp_printf("In 2, 1 ho %Zd\n", val);
  printf("Sto per scrivere un altro mpz\n");
  mpz_set_str(mp, "456", 10);
  set_matrix_mpz(matrice, 3, 2, mp);
  printf("Sto per leggere l'altro mpz\n");
  get_matrix_mpz(val, matrice, 3, 2);
  gmp_printf("Ho letto %Zd\n", val);
  printf("Scrivo sul bordo\n");
  mpz_set_str(mp, "111", 10);
  set_matrix_mpz(matrice, 4, 4, mp);
  printf("Leggo dal bordo\n");
  get_matrix_mpz(val, matrice, 4, 4);
  gmp_printf("Letto dal bordo %Zd\n", val);
  printf("Scrivo su 0 0\n");
  mpz_set_str(mp, "999", 10);
  set_matrix_mpz(matrice, 0, 0, mp);
  printf("Leggo da 0 0\n");
  get_matrix_mpz(val, matrice, 0, 0);
  gmp_printf("Letto dal bordo %Zd\n", val);
  printf("Scrivo un numerone su 4 4");
  mpz_set_str(mp, "48684452497254157854275812471527415472541674157424", 10);
  set_matrix_mpz(matrice, 4, 4, mp);
  printf("Leggo da 4 4 il numerone\n");
  get_matrix_mpz(val, matrice, 4, 4);
  gmp_printf("Letto da 4 4 %Zd\n", val);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x8(%rbp),%rdi
mov    $0x5,%edx
mov    %edx,%esi
call   1040 <init_matrix_mpz@plt>
mov    -0x10(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x10(%rbp),%edi
lea    0xe66(%rip),%rsi
mov    $0xa,%edx
call   1070 <mpz_set_str@plt>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%ecx
mov    $0x2,%edx
mov    %edx,%esi
call   1060 <set_matrix_mpz@plt>
mov    -0x14(%rbp),%edi
call   1050 <mpz_init@plt>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    $0x2,%ecx
mov    %ecx,%edx
call   1090 <get_matrix_mpz@plt>
mov    -0x14(%rbp),%esi
lea    0xe62(%rip),%rdi
call   1080 <gmp_printf@plt>
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
lea    0xe76(%rip),%rsi
mov    $0xa,%edx
call   1070 <mpz_set_str@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%ecx
mov    $0x3,%esi
mov    $0x2,%edx
call   1060 <set_matrix_mpz@plt>
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    $0x3,%edx
mov    $0x2,%ecx
call   1090 <get_matrix_mpz@plt>
mov    -0x14(%rbp),%esi
lea    0xe4b(%rip),%rdi
call   1080 <gmp_printf@plt>
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
lea    0xe50(%rip),%rsi
mov    $0xa,%edx
call   1070 <mpz_set_str@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%ecx
mov    $0x4,%edx
mov    %edx,%esi
call   1060 <set_matrix_mpz@plt>
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    $0x4,%ecx
mov    %ecx,%edx
call   1090 <get_matrix_mpz@plt>
mov    -0x14(%rbp),%esi
lea    0xe1f(%rip),%rdi
call   1080 <gmp_printf@plt>
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
lea    0xe28(%rip),%rsi
mov    $0xa,%edx
call   1070 <mpz_set_str@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%ecx
xor    %edx,%edx
mov    %edx,%esi
call   1060 <set_matrix_mpz@plt>
lea    0xe0b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1090 <get_matrix_mpz@plt>
mov    -0x14(%rbp),%esi
lea    0xdc4(%rip),%rdi
call   1080 <gmp_printf@plt>
lea    0xdee(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
lea    0xdf9(%rip),%rsi
mov    $0xa,%edx
call   1070 <mpz_set_str@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%ecx
mov    $0x4,%edx
mov    %edx,%esi
call   1060 <set_matrix_mpz@plt>
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    $0x4,%ecx
mov    %ecx,%edx
call   1090 <get_matrix_mpz@plt>
mov    -0x14(%rbp),%esi
lea    0xe00(%rip),%rdi
call   1080 <gmp_printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
call   1050 <init_matrix_mpz@plt>
call   1060 <mpz_init@plt>
lea    0xe5b(%rip),%rsi
mov    $0xa,%edx
call   1080 <mpz_set_str@plt>
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rdi
mov    $0x2,%esi
mov    $0x2,%edx
call   1070 <set_matrix_mpz@plt>
call   1060 <mpz_init@plt>
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rsi
mov    $0x2,%edx
mov    $0x2,%ecx
call   10a0 <get_matrix_mpz@plt>
lea    0xe2d(%rip),%rdi
call   1090 <gmp_printf@plt>
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xe25(%rip),%rsi
mov    $0xa,%edx
call   1080 <mpz_set_str@plt>
mov    0x8(%rsp),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
call   1070 <set_matrix_mpz@plt>
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rsi
mov    $0x3,%edx
mov    $0x2,%ecx
call   10a0 <get_matrix_mpz@plt>
lea    0xde4(%rip),%rdi
call   1090 <gmp_printf@plt>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xdda(%rip),%rsi
mov    $0xa,%edx
call   1080 <mpz_set_str@plt>
mov    0x8(%rsp),%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   1070 <set_matrix_mpz@plt>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rsi
mov    $0x4,%edx
mov    $0x4,%ecx
call   10a0 <get_matrix_mpz@plt>
lea    0xd99(%rip),%rbx
mov    %rbx,%rdi
call   1090 <gmp_printf@plt>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
lea    0xd93(%rip),%rsi
mov    $0xa,%edx
call   1080 <mpz_set_str@plt>
mov    0x8(%rsp),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <set_matrix_mpz@plt>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   10a0 <get_matrix_mpz@plt>
mov    %rbx,%rdi
call   1090 <gmp_printf@plt>
lea    0xd56(%rip),%rdi
call   1040 <printf@plt>
lea    0xd64(%rip),%rsi
mov    $0xa,%edx
call   1080 <mpz_set_str@plt>
mov    0x8(%rsp),%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   1070 <set_matrix_mpz@plt>
lea    0xe26(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%rsi
mov    $0x4,%edx
mov    $0x4,%ecx
call   10a0 <get_matrix_mpz@plt>
lea    0xd52(%rip),%rdi
call   1090 <gmp_printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"258584478548548754825896954865781478158\00"
@.str.1 = [23 x i8] c"Sto per settare l'mpz\0A\00"
@.str.2 = [23 x i8] c"Sto per leggere l'mpz\0A\00"
@.str.3 = [16 x i8] c"In 2, 1 ho %Zd\0A\00"
@.str.4 = [31 x i8] c"Sto per scrivere un altro mpz\0A\00"
@.str.5 = [4 x i8] c"456\00"
@.str.6 = [29 x i8] c"Sto per leggere l'altro mpz\0A\00"
@.str.7 = [14 x i8] c"Ho letto %Zd\0A\00"
@.str.8 = [18 x i8] c"Scrivo sul bordo\0A\00"
@.str.9 = [4 x i8] c"111\00"
@.str.10 = [17 x i8] c"Leggo dal bordo\0A\00"
@.str.11 = [21 x i8] c"Letto dal bordo %Zd\0A\00"
@.str.12 = [15 x i8] c"Scrivo su 0 0\0A\00"
@.str.13 = [4 x i8] c"999\00"
@.str.14 = [14 x i8] c"Leggo da 0 0\0A\00"
@.str.15 = [26 x i8] c"Scrivo un numerone su 4 4\00"
@.str.16 = [51 x i8] c"48684452497254157854275812471527415472541674157424\00"
@.str.17 = [26 x i8] c"Leggo da 4 4 il numerone\0A\00"
@.str.18 = [18 x i8] c"Letto da 4 4 %Zd\0A\00"
define i32 @main() {
%1 = alloca i32**
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @init_matrix_mpz(i32*** %1, i32 5, i32 5)
%6 = load i32, i32* %3
%7 = call i32 @mpz_init(i32 %6)
%8 = load i32, i32* %3
%9 = call i32 @mpz_set_str(i32 %8, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 10)
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32**, i32*** %1
%12 = load i32, i32* %3
%13 = call i32 @set_matrix_mpz(i32** %11, i32 2, i32 2, i32 %12)
%14 = load i32, i32* %4
%15 = call i32 @mpz_init(i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %4
%18 = load i32**, i32*** %1
%19 = call i32 @get_matrix_mpz(i32 %17, i32** %18, i32 2, i32 2)
%20 = load i32, i32* %4
%21 = call i32 @gmp_printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%23 = load i32, i32* %3
%24 = call i32 @mpz_set_str(i32 %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 10)
%25 = load i32**, i32*** %1
%26 = load i32, i32* %3
%27 = call i32 @set_matrix_mpz(i32** %25, i32 3, i32 2, i32 %26)
%28 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%29 = load i32, i32* %4
%30 = load i32**, i32*** %1
%31 = call i32 @get_matrix_mpz(i32 %29, i32** %30, i32 3, i32 2)
%32 = load i32, i32* %4
%33 = call i32 @gmp_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %32)
%34 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%35 = load i32, i32* %3
%36 = call i32 @mpz_set_str(i32 %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 10)
%37 = load i32**, i32*** %1
%38 = load i32, i32* %3
%39 = call i32 @set_matrix_mpz(i32** %37, i32 4, i32 4, i32 %38)
%40 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
%41 = load i32, i32* %4
%42 = load i32**, i32*** %1
%43 = call i32 @get_matrix_mpz(i32 %41, i32** %42, i32 4, i32 4)
%44 = load i32, i32* %4
%45 = call i32 @gmp_printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 %44)
%46 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%47 = load i32, i32* %3
%48 = call i32 @mpz_set_str(i32 %47, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 10)
%49 = load i32**, i32*** %1
%50 = load i32, i32* %3
%51 = call i32 @set_matrix_mpz(i32** %49, i32 0, i32 0, i32 %50)
%52 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0))
%53 = load i32, i32* %4
%54 = load i32**, i32*** %1
%55 = call i32 @get_matrix_mpz(i32 %53, i32** %54, i32 0, i32 0)
%56 = load i32, i32* %4
%57 = call i32 @gmp_printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 %56)
%58 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.15, i64 0, i64 0))
%59 = load i32, i32* %3
%60 = call i32 @mpz_set_str(i32 %59, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.16, i64 0, i64 0), i32 10)
%61 = load i32**, i32*** %1
%62 = load i32, i32* %3
%63 = call i32 @set_matrix_mpz(i32** %61, i32 4, i32 4, i32 %62)
%64 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.17, i64 0, i64 0))
%65 = load i32, i32* %4
%66 = load i32**, i32*** %1
%67 = call i32 @get_matrix_mpz(i32 %65, i32** %66, i32 4, i32 4)
%68 = load i32, i32* %4
%69 = call i32 @gmp_printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i32 %68)
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"258584478548548754825896954865781478158\00"
@.str.3 = [16 x i8] c"In 2, 1 ho %Zd\0A\00"
@.str.5 = [4 x i8] c"456\00"
@.str.7 = [14 x i8] c"Ho letto %Zd\0A\00"
@.str.9 = [4 x i8] c"111\00"
@.str.11 = [21 x i8] c"Letto dal bordo %Zd\0A\00"
@.str.13 = [4 x i8] c"999\00"
@.str.15 = [26 x i8] c"Scrivo un numerone su 4 4\00"
@.str.16 = [51 x i8] c"48684452497254157854275812471527415472541674157424\00"
@.str.18 = [18 x i8] c"Letto da 4 4 %Zd\0A\00"
@str = [22 x i8] c"Sto per settare l'mpz\00"
@str.19 = [22 x i8] c"Sto per leggere l'mpz\00"
@str.20 = [30 x i8] c"Sto per scrivere un altro mpz\00"
@str.21 = [28 x i8] c"Sto per leggere l'altro mpz\00"
@str.22 = [17 x i8] c"Scrivo sul bordo\00"
@str.23 = [16 x i8] c"Leggo dal bordo\00"
@str.24 = [14 x i8] c"Scrivo su 0 0\00"
@str.25 = [13 x i8] c"Leggo da 0 0\00"
@str.26 = [25 x i8] c"Leggo da 4 4 il numerone\00"
define i32 @main() {
%1 = alloca i32**
%2 = bitcast i32*** %1 to i8*
%3 = call i32 @init_matrix_mpz(i32*** %1, i32 5, i32 5)
%4 = call i32 @mpz_init(i32 undef)
%5 = call i32 @mpz_set_str(i32 undef, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 10)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%7 = load i32**, i32*** %1
%8 = call i32 @set_matrix_mpz(i32** %7, i32 2, i32 2, i32 undef)
%9 = call i32 @mpz_init(i32 undef)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.19, i64 0, i64 0))
%11 = load i32**, i32*** %1
%12 = call i32 @get_matrix_mpz(i32 undef, i32** %11, i32 2, i32 2)
%13 = call i32 @gmp_printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 undef)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.20, i64 0, i64 0))
%15 = call i32 @mpz_set_str(i32 undef, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 10)
%16 = load i32**, i32*** %1
%17 = call i32 @set_matrix_mpz(i32** %16, i32 3, i32 2, i32 undef)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.21, i64 0, i64 0))
%19 = load i32**, i32*** %1
%20 = call i32 @get_matrix_mpz(i32 undef, i32** %19, i32 3, i32 2)
%21 = call i32 @gmp_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 undef)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.22, i64 0, i64 0))
%23 = call i32 @mpz_set_str(i32 undef, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 10)
%24 = load i32**, i32*** %1
%25 = call i32 @set_matrix_mpz(i32** %24, i32 4, i32 4, i32 undef)
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.23, i64 0, i64 0))
%27 = load i32**, i32*** %1
%28 = call i32 @get_matrix_mpz(i32 undef, i32** %27, i32 4, i32 4)
%29 = call i32 @gmp_printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 undef)
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.24, i64 0, i64 0))
%31 = call i32 @mpz_set_str(i32 undef, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32 10)
%32 = load i32**, i32*** %1
%33 = call i32 @set_matrix_mpz(i32** %32, i32 0, i32 0, i32 undef)
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.25, i64 0, i64 0))
%35 = load i32**, i32*** %1
%36 = call i32 @get_matrix_mpz(i32 undef, i32** %35, i32 0, i32 0)
%37 = call i32 @gmp_printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i32 undef)
%38 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.15, i64 0, i64 0))
%39 = call i32 @mpz_set_str(i32 undef, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.16, i64 0, i64 0), i32 10)
%40 = load i32**, i32*** %1
%41 = call i32 @set_matrix_mpz(i32** %40, i32 4, i32 4, i32 undef)
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.26, i64 0, i64 0))
%43 = load i32**, i32*** %1
%44 = call i32 @get_matrix_mpz(i32 undef, i32** %43, i32 4, i32 4)
%45 = call i32 @gmp_printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), i32 undef)
ret i32 0
}