#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void get_row_col(int *p_row, int *p_col, char *p_row_disp, char *p_col_disp,
                 char *p_err_string, int (*p_checker)(int *, int *)) {
  do {
    printf(p_row_disp);
    scanf("%d", p_row);
    printf(p_col_disp);
    scanf("%d", p_col);
    if (p_checker(p_row, p_col))
      break;
    else
      printf(p_err_string);
  } while (1);
}


x86 assembly (clang, -O0):
<get_row_col>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   *%rax
cmp    $0x0,%eax
je     118e <get_row_col+0x6e>
jmp    11ab <get_row_col+0x8b>
mov    -0x28(%rbp),%rdi
call   1030 <printf@plt>
jmp    119c <get_row_col+0x7c>
mov    $0x1,%al
test   $0x1,%al
jne    1140 <get_row_col+0x20>
jmp    11ab <get_row_col+0x8b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_row_col>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r15
mov    %r8,(%rsp)
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rdx,%rdi
call   1030 <printf@plt>
lea    0xeb3(%rip),%r14
mov    %r14,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
mov    %r12,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   *%r15
test   %eax,%eax
jne    11bc <get_row_col+0x9c>
lea    0xe81(%rip),%r14
nop
mov    (%rsp),%rdi
call   1030 <printf@plt>
mov    %r13,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1040 <scanf@plt>
mov    %r12,%rdi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   *%r15
test   %eax,%eax
je     1180 <get_row_col+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @get_row_col(i32* %0, i32* %1, i8* %2, i8* %3, i8* %4, i32 (i32*, i32*)* %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32 (i32*, i32*)*
store i32* %0, i32** %7
store i32* %1, i32** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i32 (i32*, i32*)* %5, i32 (i32*, i32*)** %12
br label %13
13: ; preds = %32, %6
%14 = load i8*, i8** %9
%15 = call i32 @printf(i8* %14)
%16 = load i32*, i32** %7
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
%18 = load i8*, i8** %10
%19 = call i32 @printf(i8* %18)
%20 = load i32*, i32** %8
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %20)
%22 = load i32 (i32*, i32*)*, i32 (i32*, i32*)** %12
%23 = load i32*, i32** %7
%24 = load i32*, i32** %8
%25 = call i32 %22(i32* %23, i32* %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %13
br label %33
28: ; preds = %13
%29 = load i8*, i8** %11
%30 = call i32 @printf(i8* %29)
br label %31
31: ; preds = %28
br label %32
32: ; preds = %31
br i1 true, label %13, label %33
33: ; preds = %32, %27
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @get_row_col(i32* %0, i32* %1, i8* nocapture %2, i8* nocapture %3, i8* nocapture %4, i32 (i32*, i32*)* nocapture %5) {
%7 = tail call i32 @printf(i8* dereferenceable(1) %2)
%8 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %0)
%9 = tail call i32 @printf(i8* dereferenceable(1) %3)
%10 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%11 = tail call i32 %5(i32* %0, i32* %1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %6, %13
%14 = tail call i32 @printf(i8* dereferenceable(1) %4)
%15 = tail call i32 @printf(i8* dereferenceable(1) %2)
%16 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %0)
%17 = tail call i32 @printf(i8* dereferenceable(1) %3)
%18 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%19 = tail call i32 %5(i32* %0, i32* %1)
%20 = icmp eq i32 %19, 0
br i1 %20, label %13, label %21
21: ; preds = %13, %6
ret void
}