#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ check_intInput(int *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fill_D_array(int, int, int **);
int /*<<< orphan*/ print_main_diagonal(int, int, int **);
int /*<<< orphan*/ printf(char *);
int main() {
  int n;
  printf("Enter row: ");
  check_intInput(&n);
  if (n <= 0) {
    printf("n > 0 !");
    exit(EXIT_FAILURE);
  }
  int buffer[n][n];
  printf("Enter matrix element:\n");
  fill_D_array(n, n, buffer);
  printf("Numbers Beneath Main Diagonal.\n");
  print_main_diagonal(n, n, buffer);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1040 <check_intInput@plt>
cmpl   $0x0,-0x8(%rbp)
jg     1198 <main+0x48>
lea    0xe87(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rsp,%rdx
mov    %rdx,-0x10(%rbp)
mov    %rcx,%rdx
imul   %rdx,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x28(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
lea    0xe3e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <fill_D_array@plt>
lea    0xe3a(%rip),%rdi
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <print_main_diagonal@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%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   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe8e(%rip),%rdi
call   1060 <printf@plt>
lea    -0x14(%rbp),%rdi
call   1040 <check_intInput@plt>
mov    -0x14(%rbp),%eax
test   %eax,%eax
jle    11ea <main+0x8a>
mov    %rsp,%r14
imul   %rax,%rax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe6a(%rip),%rdi
call   1050 <puts@plt>
mov    -0x14(%rbp),%edi
mov    %edi,%esi
mov    %rbx,%rdx
call   1070 <fill_D_array@plt>
lea    0xe67(%rip),%rdi
call   1050 <puts@plt>
mov    -0x14(%rbp),%edi
mov    %edi,%esi
mov    %rbx,%rdx
call   1030 <print_main_diagonal@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%eax
mov    %r14,%rsp
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe1b(%rip),%rdi
call   1060 <printf@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Enter row: \00"
@.str.1 = [8 x i8] c"n > 0 !\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [23 x i8] c"Enter matrix element:\0A\00"
@.str.3 = [32 x i8] c"Numbers Beneath Main Diagonal.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @check_intInput(i32* %2)
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %0
%15 = load i32, i32* %2
%16 = zext i32 %15 to i64
%17 = load i32, i32* %2
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %3
%20 = mul nuw i64 %16, %18
%21 = alloca i32, i64 %20
store i64 %16, i64* %4
store i64 %18, i64* %5
%22 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%23 = load i32, i32* %2
%24 = load i32, i32* %2
%25 = bitcast i32* %21 to i32**
%26 = call i32 @fill_D_array(i32 %23, i32 %24, i32** %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* %2
%29 = load i32, i32* %2
%30 = bitcast i32* %21 to i32**
%31 = call i32 @print_main_diagonal(i32 %28, i32 %29, i32** %30)
%32 = load i32, i32* @EXIT_SUCCESS
store i32 %32, i32* %1
%33 = load i8*, i8** %3
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [12 x i8] c"Enter row: \00"
@.str.1 = [8 x i8] c"n > 0 !\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [22 x i8] c"Enter matrix element:\00"
@str.4 = [31 x i8] c"Numbers Beneath Main Diagonal.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @check_intInput(i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
%12 = zext i32 %5 to i64
%13 = call i8* @llvm.stacksave()
%14 = mul nuw nsw i64 %12, %12
%15 = alloca i32, i64 %14
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%17 = load i32, i32* %1
%18 = bitcast i32* %15 to i32**
%19 = call i32 @fill_D_array(i32 %17, i32 %17, i32** %18)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.4, i64 0, i64 0))
%21 = load i32, i32* %1
%22 = call i32 @print_main_diagonal(i32 %21, i32 %21, i32** %18)
%23 = load i32, i32* @EXIT_SUCCESS
ret i32 %23
}