#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int nametokeypress_i(int, int);
int /*<<< orphan*/ printkeymapping(int /*<<< orphan*/ *, int, int);
void writeinputconf(FILE *fp, const char *devkey) {
  int keypress, flags = 0;
  int i = 0;
  if (0)
    i = devkey[2] - '0' + 1;
mappings:
  i = -1;
  do {
    if (i == 5 && !0 || i == 7)
      i += 2;
    else if (i == 11)
      i = 8;
    else
      i++;
    keypress = nametokeypress_i(i, flags);
    if (0)
      ;
    else
      printkeymapping(fp, keypress, i);
  } while (i != 8);
  if (0)
    return;
}


x86 assembly (clang, -O0):
<writeinputconf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
je     1159 <writeinputconf+0x39>
cmpl   $0x7,-0x1c(%rbp)
jne    1167 <writeinputconf+0x47>
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    118b <writeinputconf+0x6b>
cmpl   $0xb,-0x1c(%rbp)
jne    117d <writeinputconf+0x5d>
movl   $0x8,-0x1c(%rbp)
jmp    1186 <writeinputconf+0x66>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118b <writeinputconf+0x6b>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <nametokeypress_i@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <printkeymapping@plt>
cmpl   $0x8,-0x1c(%rbp)
jne    1145 <writeinputconf+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeinputconf>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    $0xffffffff,%eax
mov    $0x8,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
and    $0xfffffffd,%ecx
lea    0x1(%rax),%ebp
cmp    $0xb,%eax
cmove  %r14d,%ebp
add    $0x2,%eax
cmp    $0x5,%ecx
cmove  %eax,%ebp
mov    %ebp,%edi
xor    %esi,%esi
call   1030 <nametokeypress_i@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %ebp,%edx
call   1040 <printkeymapping@plt>
mov    %ebp,%eax
cmp    $0x8,%ebp
jne    1140 <writeinputconf+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @writeinputconf(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 0, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %2
store i32 -1, i32* %7
br label %9
9: ; preds = %34, %8
%10 = load i32, i32* %7
%11 = icmp eq i32 %10, 5
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i32, i32* %7
%14 = icmp eq i32 %13, 7
br i1 %14, label %15, label %18
15: ; preds = %12, %9
%16 = load i32, i32* %7
%17 = add nsw i32 %16, 2
store i32 %17, i32* %7
br label %26
18: ; preds = %12
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 11
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 8, i32* %7
br label %25
22: ; preds = %18
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %25
25: ; preds = %22, %21
br label %26
26: ; preds = %25, %15
%27 = load i32, i32* %7
%28 = load i32, i32* %6
%29 = call i32 @nametokeypress_i(i32 %27, i32 %28)
store i32 %29, i32* %5
%30 = load i32*, i32** %3
%31 = load i32, i32* %5
%32 = load i32, i32* %7
%33 = call i32 @printkeymapping(i32* %30, i32 %31, i32 %32)
br label %34
34: ; preds = %26
%35 = load i32, i32* %7
%36 = icmp ne i32 %35, 8
br i1 %36, label %9, label %37
37: ; preds = %34
ret void
}

LLVM IR (-O2):
define void @writeinputconf(i32* %0, i8* nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ -1, %2 ], [ %11, %3 ]
%5 = and i32 %4, -3
%6 = icmp eq i32 %5, 5
%7 = add nsw i32 %4, 2
%8 = icmp eq i32 %4, 11
%9 = add nsw i32 %4, 1
%10 = select i1 %8, i32 8, i32 %9
%11 = select i1 %6, i32 %7, i32 %10
%12 = tail call i32 @nametokeypress_i(i32 %11, i32 0)
%13 = tail call i32 @printkeymapping(i32* %0, i32 %12, i32 %11)
%14 = icmp eq i32 %11, 8
br i1 %14, label %15, label %3
15: ; preds = %3
ret void
}