#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);
int getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  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);
    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    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xa,%eax
je     11ad <main+0x6d>
lea    0xeb0(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <display@plt>
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
jmp    115b <main+0x1b>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%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,%eax
je     11ca <main+0x8a>
mov    %eax,%ebp
lea    0xe94(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%r12
lea    0xeb4(%rip),%r13
lea    0xed7(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
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>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
cmp    $0xa,%eax
jne    1190 <main+0x50>
lea    0xe59(%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 = [37 x i8] c"Enter a character and two integers:\0A\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [43 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() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %9, %0
%7 = call i32 (...) @getchar()
store i32 %7, i32* %2
%8 = icmp ne i32 %7, 10
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @display(i32 %11, i32 %12, i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %6
17: ; preds = %6
%18 = 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 = [36 x i8] c"Enter a character and two integers:\00"
@str.5 = [5 x i8] c"Bye.\00"
@str.6 = [42 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() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%6 = call i32 (...) @getchar()
%7 = icmp eq i32 %6, 10
br i1 %7, label %18, label %8
8: ; preds = %0, %8
%9 = phi i32 [ %16, %8 ], [ %6, %0 ]
%10 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = call i32 @display(i32 %9, i32 %11, i32 %12)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.6, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
%16 = call i32 (...) @getchar()
%17 = icmp eq i32 %16, 10
br i1 %17, label %18, label %8
18: ; preds = %8, %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}