#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, int *, int *, char *);
int /*<<< orphan*/ stdin;
void getSizeForArray(int arraynumber, int sizearray[2]) {
  int inputinvalid;
  char c;
  do {
    printf("Zeilen,Spalten der %d. Matrix: ", arraynumber);
    inputinvalid =
        scanf("%d,%d%c", &sizearray[0], &sizearray[1], &c) != 3 || c != '\n';
    fflush(stdin);
    inputinvalid |= sizearray[0] < 1;
    inputinvalid |= sizearray[1] < 1;
    if (inputinvalid)
      printf("Eingabe ungueltig.\n");
  } while (inputinvalid);
}


x86 assembly (clang, -O0):
<getSizeForArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
add    $0x4,%rdx
lea    0xebd(%rip),%rdi
lea    -0x15(%rbp),%rcx
call   1050 <scanf@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x3,%ecx
mov    %al,-0x16(%rbp)
jne    1189 <getSizeForArray+0x59>
movsbl -0x15(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x1,(%rax)
setl   %al
and    $0x1,%al
movzbl %al,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x1,0x4(%rax)
setl   %al
and    $0x1,%al
movzbl %al,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11e5 <getSizeForArray+0xb5>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ea <getSizeForArray+0xba>
cmpl   $0x0,-0x14(%rbp)
jne    113f <getSizeForArray+0xf>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSizeForArray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r14d
lea    0x4(%rsi),%rbp
mov    0x2e8c(%rip),%r15
jmp    116c <getSizeForArray+0x2c>
xchg   %ax,%ax
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8d(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
lea    0x7(%rsp),%rcx
call   1060 <scanf@plt>
mov    %eax,%r12d
movzbl 0x7(%rsp),%r13d
mov    (%r15),%edi
call   1050 <fflush@plt>
cmp    $0x3,%r12d
jne    1160 <getSizeForArray+0x20>
cmp    $0xa,%r13b
jne    1160 <getSizeForArray+0x20>
cmpl   $0x0,(%rbx)
jle    1160 <getSizeForArray+0x20>
cmpl   $0x0,0x4(%rbx)
jle    1160 <getSizeForArray+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Zeilen,Spalten der %d. Matrix: \00"
@.str.1 = [8 x i8] c"%d,%d%c\00"
@stdin = global i32 0
@.str.2 = [20 x i8] c"Eingabe ungueltig.\0A\00"
define void @getSizeForArray(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8
store i32 %0, i32* %3
store i32* %1, i32** %4
br label %7
7: ; preds = %44, %2
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %11, i32* %13, i8* %6)
%15 = icmp ne i32 %14, 3
br i1 %15, label %20, label %16
16: ; preds = %7
%17 = load i8, i8* %6
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 10
br label %20
20: ; preds = %16, %7
%21 = phi i1 [ true, %7 ], [ %19, %16 ]
%22 = zext i1 %21 to i32
store i32 %22, i32* %5
%23 = load i32, i32* @stdin
%24 = call i32 @fflush(i32 %23)
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 0
%27 = load i32, i32* %26
%28 = icmp slt i32 %27, 1
%29 = zext i1 %28 to i32
%30 = load i32, i32* %5
%31 = or i32 %30, %29
store i32 %31, i32* %5
%32 = load i32*, i32** %4
%33 = getelementptr inbounds i32, i32* %32, i64 1
%34 = load i32, i32* %33
%35 = icmp slt i32 %34, 1
%36 = zext i1 %35 to i32
%37 = load i32, i32* %5
%38 = or i32 %37, %36
store i32 %38, i32* %5
%39 = load i32, i32* %5
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %20
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %41, %20
br label %44
44: ; preds = %43
%45 = load i32, i32* %5
%46 = icmp ne i32 %45, 0
br i1 %46, label %7, label %47
47: ; preds = %44
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Zeilen,Spalten der %d. Matrix: \00"
@.str.1 = [8 x i8] c"%d,%d%c\00"
@stdin = global i32 0
@str = [19 x i8] c"Eingabe ungueltig.\00"
define void @getSizeForArray(i32 %0, i32* %1) {
%3 = alloca i8
%4 = getelementptr inbounds i32, i32* %1, i64 1
br label %5
5: ; preds = %20, %2
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %4, i8* %3)
%8 = icmp ne i32 %7, 3
%9 = load i8, i8* %3
%10 = icmp ne i8 %9, 10
%11 = select i1 %8, i1 true, i1 %10
%12 = load i32, i32* @stdin
%13 = call i32 @fflush(i32 %12)
%14 = load i32, i32* %1
%15 = icmp slt i32 %14, 1
%16 = or i1 %11, %15
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 1
%19 = or i1 %16, %18
br i1 %19, label %20, label %22
20: ; preds = %5
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %5
22: ; preds = %5
ret void
}