#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*/ display(int, int, int);
char getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(int argc, const char *argv[]) {
  int ch;
  int rows, cols;
  printf("Enter a character and two integers: \n");
  while ((ch = getchar()) != '\n') {
    scanf("%d %d", &rows, &cols);
    display(ch, rows, cols);
    while (getchar() != '\n') {
      continue;
    }
    printf("Enter another character and two integers: \n");
    printf("Enter a newline to quit.\n");
  }
  printf("Bye.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
mov    %eax,-0x14(%rbp)
cmp    $0xa,%eax
je     11cf <main+0x8f>
lea    0xea7(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1030 <display@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11b2 <main+0x72>
jmp    119a <main+0x5a>
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
jmp    1162 <main+0x22>
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     11c6 <main+0x86>
lea    0xe97(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%r12
lea    0xeb8(%rip),%r13
lea    0xedc(%rip),%rbx
nop
movsbl %al,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %ebp,%edi
call   1040 <display@plt>
nop
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    11a0 <main+0x60>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    1180 <main+0x40>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Enter a character and two integers: \0A\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [44 x i8] c"Enter another character and two integers: \0A\00"
@.str.3 = [26 x i8] c"Enter a newline to quit.\0A\00"
@.str.4 = [6 x i8] c"Bye.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %25, %2
%11 = call signext i8 (...) @getchar()
%12 = sext i8 %11 to i32
store i32 %12, i32* %6
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %8)
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = call i32 @display(i32 %16, i32 %17, i32 %18)
br label %20
20: ; preds = %24, %14
%21 = call signext i8 (...) @getchar()
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 10
br i1 %23, label %24, label %25
24: ; preds = %20
br label %20
25: ; preds = %20
%26 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %10
28: ; preds = %10
%29 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d %d\00"
@str = [37 x i8] c"Enter a character and two integers: \00"
@str.5 = [5 x i8] c"Bye.\00"
@str.6 = [43 x i8] c"Enter another character and two integers: \00"
@str.7 = [25 x i8] c"Enter a newline to quit.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%8 = call signext i8 (...) @getchar()
%9 = icmp eq i8 %8, 10
br i1 %9, label %25, label %10
10: ; preds = %2, %20
%11 = phi i8 [ %23, %20 ], [ %8, %2 ]
%12 = sext i8 %11 to i32
%13 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @display(i32 %12, i32 %14, i32 %15)
br label %17
17: ; preds = %17, %10
%18 = call signext i8 (...) @getchar()
%19 = icmp eq i8 %18, 10
br i1 %19, label %20, label %17
20: ; preds = %17
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.6, i64 0, i64 0))
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
%23 = call signext i8 (...) @getchar()
%24 = icmp eq i8 %23, 10
br i1 %24, label %25, label %10
25: ; preds = %20, %2
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}