#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*/ delete_row(int **, int *, int);
scalar_t__ prima_cifra(int);
int /*<<< orphan*/ print_matrix(int **, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read_matrix(int ***, int *, int *);
int main() {
  int **matrix, n, m, i, j, ok;
  read_matrix(&matrix, &n, &m);
  print_matrix(matrix, n, m);
  for (i = 0; i < n; i++) {
    ok = 1;
    for (j = 0; j < m; j++)
      if (prima_cifra(matrix[i][0]) != prima_cifra(matrix[i][j]))
        ok = 0;
    if (ok) {
      delete_row(matrix, &n, i);
      printf("New row deleted.");
      print_matrix(matrix, n, m);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <read_matrix@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1070 <print_matrix@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    124d <main+0xfd>
movl   $0x1,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1205 <main+0xb5>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%edi
call   1050 <prima_cifra@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1050 <prima_cifra@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     11f2 <main+0xa2>
movl   $0x0,-0x24(%rbp)
jmp    11f7 <main+0xa7>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11a0 <main+0x50>
cmpl   $0x0,-0x24(%rbp)
je     123a <main+0xea>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    -0x14(%rbp),%rsi
call   1030 <delete_row@plt>
lea    0xdda(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1070 <print_matrix@plt>
jmp    123f <main+0xef>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1186 <main+0x36>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1060 <read_matrix@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
call   1070 <print_matrix@plt>
cmpl   $0x0,0x8(%rsp)
jle    122c <main+0xdc>
xor    %r12d,%r12d
lea    0x8(%rsp),%r14
lea    0xe62(%rip),%r15
jmp    11dd <main+0x8d>
test   %r13d,%r13d
je     11cf <main+0x7f>
mov    0x10(%rsp),%rdi
mov    %r14,%rsi
mov    %r12d,%edx
call   1030 <delete_row@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    0x10(%rsp),%rdi
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
call   1070 <print_matrix@plt>
add    $0x1,%r12
movslq 0x8(%rsp),%rax
cmp    %rax,%r12
jge    122c <main+0xdc>
cmpl   $0x0,0xc(%rsp)
jle    11a5 <main+0x55>
mov    $0x1,%r13d
xor    %ebp,%ebp
jmp    11fe <main+0xae>
xchg   %ax,%ax
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jge    11a0 <main+0x50>
mov    0x10(%rsp),%rax
mov    (%rax,%r12,8),%rax
mov    (%rax),%edi
call   1050 <prima_cifra@plt>
mov    %rax,%rbx
mov    0x10(%rsp),%rax
mov    (%rax,%r12,8),%rax
mov    (%rax,%rbp,4),%edi
call   1050 <prima_cifra@plt>
cmp    %rax,%rbx
je     11f0 <main+0xa0>
xor    %r13d,%r13d
jmp    11f0 <main+0xa0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"New row deleted.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32**
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @read_matrix(i32*** %2, i32* %3, i32* %4)
%9 = load i32**, i32*** %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @print_matrix(i32** %9, i32 %10, i32 %11)
store i32 0, i32* %5
br label %13
13: ; preds = %60, %0
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %63
17: ; preds = %13
store i32 1, i32* %7
store i32 0, i32* %6
br label %18
18: ; preds = %44, %17
%19 = load i32, i32* %6
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %47
22: ; preds = %18
%23 = load i32**, i32*** %2
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32*, i32** %23, i64 %25
%27 = load i32*, i32** %26
%28 = getelementptr inbounds i32, i32* %27, i64 0
%29 = load i32, i32* %28
%30 = call i64 @prima_cifra(i32 %29)
%31 = load i32**, i32*** %2
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32*, i32** %31, i64 %33
%35 = load i32*, i32** %34
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %35, i64 %37
%39 = load i32, i32* %38
%40 = call i64 @prima_cifra(i32 %39)
%41 = icmp ne i64 %30, %40
br i1 %41, label %42, label %43
42: ; preds = %22
store i32 0, i32* %7
br label %43
43: ; preds = %42, %22
br label %44
44: ; preds = %43
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %18
47: ; preds = %18
%48 = load i32, i32* %7
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %59
50: ; preds = %47
%51 = load i32**, i32*** %2
%52 = load i32, i32* %5
%53 = call i32 @delete_row(i32** %51, i32* %3, i32 %52)
%54 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%55 = load i32**, i32*** %2
%56 = load i32, i32* %3
%57 = load i32, i32* %4
%58 = call i32 @print_matrix(i32** %55, i32 %56, i32 %57)
br label %59
59: ; preds = %50, %47
br label %60
60: ; preds = %59
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 1
store i32 %62, i32* %5
br label %13
63: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"New row deleted.\00"
define i32 @main() {
%1 = alloca i32**
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32*** %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @read_matrix(i32*** %1, i32* %2, i32* %3)
%8 = load i32**, i32*** %1
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = call i32 @print_matrix(i32** %8, i32 %9, i32 %10)
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %54
14: ; preds = %0, %49
%15 = phi i64 [ %50, %49 ], [ 0, %0 ]
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %40
18: ; preds = %14, %18
%19 = phi i64 [ %34, %18 ], [ 0, %14 ]
%20 = phi i32 [ %33, %18 ], [ 1, %14 ]
%21 = load i32**, i32*** %1
%22 = getelementptr inbounds i32*, i32** %21, i64 %15
%23 = load i32*, i32** %22
%24 = load i32, i32* %23
%25 = call i64 @prima_cifra(i32 %24)
%26 = load i32**, i32*** %1
%27 = getelementptr inbounds i32*, i32** %26, i64 %15
%28 = load i32*, i32** %27
%29 = getelementptr inbounds i32, i32* %28, i64 %19
%30 = load i32, i32* %29
%31 = call i64 @prima_cifra(i32 %30)
%32 = icmp eq i64 %25, %31
%33 = select i1 %32, i32 %20, i32 0
%34 = add nuw nsw i64 %19, 1
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %34, %36
br i1 %37, label %18, label %38
38: ; preds = %18
%39 = icmp eq i32 %33, 0
br i1 %39, label %49, label %40
40: ; preds = %14, %38
%41 = load i32**, i32*** %1
%42 = trunc i64 %15 to i32
%43 = call i32 @delete_row(i32** %41, i32* %2, i32 %42)
%44 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%45 = load i32**, i32*** %1
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = call i32 @print_matrix(i32** %45, i32 %46, i32 %47)
br label %49
49: ; preds = %38, %40
%50 = add nuw nsw i64 %15, 1
%51 = load i32, i32* %2
%52 = sext i32 %51 to i64
%53 = icmp slt i64 %50, %52
br i1 %53, label %14, label %54
54: ; preds = %49, %0
ret i32 0
}