#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 */
scalar_t__ Colonna(int **);
scalar_t__ Riga(int **);
int pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i, j, mat[10][10];
  srand(time(NULL));
  for (i = 0; i < 10; i++) {
    for (j = 0; j < 10; j++)
      printf("%3d", (mat[i][j] = rand() % 10 * pow(-1, rand() % 2)));
    printf("\n");
  }
  if (Riga(mat) || Colonna(mat))
    printf("\nLa matrice presenta una riga o una colonna tutta negativa");
  else
    printf("\nLa matrice non presenta righe o colonne tutte negative");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    123e <main+0xce>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1222 <main+0xb2>
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1a4(%rbp)
mov    $0x0,%al
call   1090 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0xffffffff,%edi
call   1080 <pow@plt>
mov    -0x1a4(%rbp),%esi
imul   %eax,%esi
movslq -0x8(%rbp),%rcx
lea    -0x1a0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    %esi,(%rax,%rcx,4)
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11aa <main+0x3a>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1199 <main+0x29>
lea    -0x1a0(%rbp),%rdi
call   1040 <Riga@plt>
cmp    $0x0,%rax
jne    126a <main+0xfa>
lea    -0x1a0(%rbp),%rdi
call   1060 <Colonna@plt>
cmp    $0x0,%rax
je     127d <main+0x10d>
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128b <main+0x11b>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x190,%rsp
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
mov    %rsp,%r15
lea    0xe58(%rip),%r14
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   10a0 <rand@plt>
movslq %eax,%rbx
imul   $0x66666667,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
xor    %eax,%eax
call   10a0 <rand@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1090 <pow@plt>
imul   %eax,%ebx
mov    %ebx,(%r15,%r13,4)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r13
cmp    $0xa,%r13
jne    11c0 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
add    $0x28,%r15
cmp    $0xa,%r12
jne    11b0 <main+0x30>
mov    %rsp,%rdi
call   1050 <Riga@plt>
test   %rax,%rax
je     1253 <main+0xd3>
lea    0xdb3(%rip),%rdi
jmp    1270 <main+0xf0>
mov    %rsp,%rdi
call   1070 <Colonna@plt>
test   %rax,%rax
lea    0xdda(%rip),%rax
lea    0xd98(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%3d\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [59 x i8] c"\0ALa matrice presenta una riga o una colonna tutta negativa\00"
@.str.3 = [56 x i8] c"\0ALa matrice non presenta righe o colonne tutte negative\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x [10 x i32]]
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
store i32 0, i32* %2
br label %7
7: ; preds = %33, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %36
10: ; preds = %7
store i32 0, i32* %3
br label %11
11: ; preds = %28, %10
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 10
%17 = call i32 (...) @rand()
%18 = srem i32 %17, 2
%19 = call i32 @pow(i32 -1, i32 %18)
%20 = mul nsw i32 %16, %19
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %4, i64 0, i64 %22
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %23, i64 0, i64 %25
store i32 %20, i32* %26
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %28
28: ; preds = %14
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %11
31: ; preds = %11
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %31
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %7
36: ; preds = %7
%37 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %4, i64 0, i64 0
%38 = bitcast [10 x i32]* %37 to i32**
%39 = call i64 @Riga(i32** %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %46, label %41
41: ; preds = %36
%42 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %4, i64 0, i64 0
%43 = bitcast [10 x i32]* %42 to i32**
%44 = call i64 @Colonna(i32** %43)
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %41, %36
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
br label %50
48: ; preds = %41
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %48, %46
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [4 x i8] c"%3d\00"
@.str.2 = [59 x i8] c"\0ALa matrice presenta una riga o una colonna tutta negativa\00"
@.str.3 = [56 x i8] c"\0ALa matrice non presenta righe o colonne tutte negative\00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = bitcast [10 x [10 x i32]]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %0, %19
%6 = phi i64 [ 0, %0 ], [ %21, %19 ]
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %17, %7 ]
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 10
%11 = tail call i32 (...) @rand()
%12 = srem i32 %11, 2
%13 = tail call i32 @pow(i32 -1, i32 %12)
%14 = mul nsw i32 %13, %10
%15 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %6, i64 %8
store i32 %14, i32* %15
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%17 = add nuw nsw i64 %8, 1
%18 = icmp eq i64 %17, 10
br i1 %18, label %19, label %7
19: ; preds = %7
%20 = tail call i32 @putchar(i32 10)
%21 = add nuw nsw i64 %6, 1
%22 = icmp eq i64 %21, 10
br i1 %22, label %23, label %5
23: ; preds = %19
%24 = bitcast [10 x [10 x i32]]* %1 to i32**
%25 = call i64 @Riga(i32** %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = call i64 @Colonna(i32** %24)
%29 = icmp eq i64 %28, 0
%30 = select i1 %29, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0)
br label %31
31: ; preds = %27, %23
%32 = phi i8* [ getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), %23 ], [ %30, %27 ]
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %32)
ret i32 0
}