#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(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stderr;
void Get_dims(int *m_p, int *n_p) {
  printf("Enter the number of rows\n");
  scanf("%d", m_p);
  printf("Enter the number of columns\n");
  scanf("%d", n_p);
  if (*m_p <= 0 || *n_p <= 0) {
    fprintf(stderr, "m and n must be positive\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<Get_dims>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1050 <scanf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe97(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jle    11a2 <Get_dims+0x62>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jg     11c1 <Get_dims+0x81>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_dims>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xea2(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
cmpl   $0x0,(%rbx)
jle    1191 <Get_dims+0x51>
cmpl   $0x0,(%r14)
jle    1191 <Get_dims+0x51>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
lea    0xe62(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Enter the number of rows\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Enter the number of columns\0A\00"
@stderr = global i32 0
@.str.3 = [26 x i8] c"m and n must be positive\0A\00"
define void @Get_dims(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%6 = load i32*, i32** %3
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32*, i32** %4
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = icmp sle i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %2
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = icmp sle i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14, %2
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @exit(i32 -1)
unreachable
22: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.3 = [26 x i8] c"m and n must be positive\0A\00"
@str = [25 x i8] c"Enter the number of rows\00"
@str.4 = [28 x i8] c"Enter the number of columns\00"
define void @Get_dims(i32* %0, i32* %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.4, i64 0, i64 0))
%6 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %0
%8 = icmp slt i32 %7, 1
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 1
br i1 %11, label %12, label %16
12: ; preds = %9, %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%15 = tail call i32 @exit(i32 -1)
unreachable
16: ; preds = %9
ret void
}