#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 */
char *getkeyfor_str(int, int /*<<< orphan*/);
int /*<<< orphan*/ inp_keypr(int);
int /*<<< orphan*/ newln(int);
int /*<<< orphan*/ printstr(char const *);
int /*<<< orphan*/ putnchars(char, scalar_t__);
int /*<<< orphan*/ setcurs(int, int);
scalar_t__ strlen(char const *);
void inp_printkeys(int dev, int x, int y) {
  const char *k;
  int i;
  x += 6;
  setcurs(x, y);
  for (i = 0; i < 11; i++) {
    k = getkeyfor_str(dev, inp_keypr(i));
    printstr(k);
    putnchars(' ', 6 - strlen(k));
    if (i == 5) {
      x += 17;
      setcurs(x, y);
    } else
      newln(x);
  }
}


x86 assembly (clang, -O0):
<inp_printkeys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1080 <setcurs@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xb,-0x1c(%rbp)
jge    1224 <inp_printkeys+0xb4>
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
call   1050 <inp_keypr@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
call   1040 <getkeyfor_str@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <printstr@plt>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x6,%esi
sub    %rax,%rsi
mov    $0x20,%edi
call   1090 <putnchars@plt>
cmpl   $0x5,-0x1c(%rbp)
jne    1209 <inp_printkeys+0x99>
mov    -0x8(%rbp),%eax
add    $0x11,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1080 <setcurs@plt>
jmp    1211 <inp_printkeys+0xa1>
mov    -0x8(%rbp),%edi
call   1060 <newln@plt>
jmp    1216 <inp_printkeys+0xa6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119c <inp_printkeys+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inp_printkeys>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %esi,%r12d
mov    %edi,%r15d
add    $0x6,%r12d
mov    %r12d,%edi
mov    %edx,%esi
call   1080 <setcurs@plt>
xor    %ebx,%ebx
jmp    11b0 <inp_printkeys+0x40>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12d,%edi
call   1060 <newln@plt>
add    $0x1,%ebx
cmp    $0xb,%ebx
je     11fc <inp_printkeys+0x8c>
mov    %ebx,%edi
call   1050 <inp_keypr@plt>
mov    %r15d,%edi
mov    %eax,%esi
call   1040 <getkeyfor_str@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   1070 <printstr@plt>
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    $0x6,%esi
sub    %rax,%rsi
mov    $0x20,%edi
call   1090 <putnchars@plt>
cmp    $0x5,%ebx
jne    11a0 <inp_printkeys+0x30>
add    $0x11,%r12d
mov    %r12d,%edi
mov    %r14d,%esi
call   1080 <setcurs@plt>
jmp    11a8 <inp_printkeys+0x38>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @inp_printkeys(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 6
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 @setcurs(i32 %11, i32 %12)
store i32 0, i32* %8
br label %14
14: ; preds = %40, %3
%15 = load i32, i32* %8
%16 = icmp slt i32 %15, 11
br i1 %16, label %17, label %43
17: ; preds = %14
%18 = load i32, i32* %4
%19 = load i32, i32* %8
%20 = call i32 @inp_keypr(i32 %19)
%21 = call i8* @getkeyfor_str(i32 %18, i32 %20)
store i8* %21, i8** %7
%22 = load i8*, i8** %7
%23 = call i32 @printstr(i8* %22)
%24 = load i8*, i8** %7
%25 = call i64 @strlen(i8* %24)
%26 = sub nsw i64 6, %25
%27 = call i32 @putnchars(i8 signext 32, i64 %26)
%28 = load i32, i32* %8
%29 = icmp eq i32 %28, 5
br i1 %29, label %30, label %36
30: ; preds = %17
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 17
store i32 %32, i32* %5
%33 = load i32, i32* %5
%34 = load i32, i32* %6
%35 = call i32 @setcurs(i32 %33, i32 %34)
br label %39
36: ; preds = %17
%37 = load i32, i32* %5
%38 = call i32 @newln(i32 %37)
br label %39
39: ; preds = %36, %30
br label %40
40: ; preds = %39
%41 = load i32, i32* %8
%42 = add nsw i32 %41, 1
store i32 %42, i32* %8
br label %14
43: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @inp_printkeys(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, 6
%5 = tail call i32 @setcurs(i32 %4, i32 %2)
br label %6
6: ; preds = %3, %21
%7 = phi i32 [ 0, %3 ], [ %23, %21 ]
%8 = phi i32 [ %4, %3 ], [ %22, %21 ]
%9 = tail call i32 @inp_keypr(i32 %7)
%10 = tail call i8* @getkeyfor_str(i32 %0, i32 %9)
%11 = tail call i32 @printstr(i8* %10)
%12 = tail call i64 @strlen(i8* dereferenceable(1) %10)
%13 = sub nsw i64 6, %12
%14 = tail call i32 @putnchars(i8 signext 32, i64 %13)
%15 = icmp eq i32 %7, 5
br i1 %15, label %16, label %19
16: ; preds = %6
%17 = add nsw i32 %8, 17
%18 = tail call i32 @setcurs(i32 %17, i32 %2)
br label %21
19: ; preds = %6
%20 = tail call i32 @newln(i32 %8)
br label %21
21: ; preds = %16, %19
%22 = phi i32 [ %17, %16 ], [ %8, %19 ]
%23 = add nuw nsw i32 %7, 1
%24 = icmp eq i32 %23, 11
br i1 %24, label %25, label %6
25: ; preds = %21
ret void
}