#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*/ Q_stricmp(char *, char *);
int /*<<< orphan*/ trap_Key_GetBindingBuf(int, char *, int);
void Controls_GetKeyAssignment(char *command, int *twokeys) {
  int count;
  int j;
  char b[256];
  twokeys[0] = twokeys[1] = -1;
  count = 0;
  for (j = 0; j < 256; j++) {
    trap_Key_GetBindingBuf(j, b, 256);
    if (*b == 0) {
      continue;
    }
    if (!Q_stricmp(b, command)) {
      twokeys[count] = j;
      count++;
      if (count == 2)
        break;
    }
  }
}


x86 assembly (clang, -O0):
<Controls_GetKeyAssignment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xffffffff,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x100,-0x18(%rbp)
jge    11e3 <Controls_GetKeyAssignment+0xc3>
mov    -0x18(%rbp),%edi
lea    -0x120(%rbp),%rsi
mov    $0x100,%edx
call   1040 <trap_Key_GetBindingBuf@plt>
movsbl -0x120(%rbp),%eax
cmp    $0x0,%eax
jne    118c <Controls_GetKeyAssignment+0x6c>
jmp    11d5 <Controls_GetKeyAssignment+0xb5>
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <Q_stricmp@plt>
cmp    $0x0,%eax
jne    11d0 <Controls_GetKeyAssignment+0xb0>
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jne    11cb <Controls_GetKeyAssignment+0xab>
jmp    11e3 <Controls_GetKeyAssignment+0xc3>
jmp    11d0 <Controls_GetKeyAssignment+0xb0>
jmp    11d5 <Controls_GetKeyAssignment+0xb5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1156 <Controls_GetKeyAssignment+0x36>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Controls_GetKeyAssignment>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movq   $0xffffffffffffffff,(%rsi)
xor    %ebp,%ebp
mov    %rsp,%r12
xor    %ebx,%ebx
jmp    115b <Controls_GetKeyAssignment+0x3b>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
cmp    $0x100,%ebp
je     118f <Controls_GetKeyAssignment+0x6f>
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0x100,%edx
call   1040 <trap_Key_GetBindingBuf@plt>
cmpb   $0x0,(%rsp)
je     1150 <Controls_GetKeyAssignment+0x30>
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <Q_stricmp@plt>
test   %eax,%eax
jne    1150 <Controls_GetKeyAssignment+0x30>
mov    %ebx,%eax
mov    %ebp,(%r14,%rax,4)
cmp    $0x1,%ebx
mov    $0x1,%ebx
jne    1150 <Controls_GetKeyAssignment+0x30>
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Controls_GetKeyAssignment(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [256 x i8]
store i8* %0, i8** %3
store i32* %1, i32** %4
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 1
store i32 -1, i32* %9
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 0
store i32 -1, i32* %11
store i32 0, i32* %5
store i32 0, i32* %6
br label %12
12: ; preds = %42, %2
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 256
br i1 %14, label %15, label %45
15: ; preds = %12
%16 = load i32, i32* %6
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%18 = call i32 @trap_Key_GetBindingBuf(i32 %16, i8* %17, i32 256)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %15
br label %42
24: ; preds = %15
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%26 = load i8*, i8** %3
%27 = call i32 @Q_stricmp(i8* %25, i8* %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %41, label %29
29: ; preds = %24
%30 = load i32, i32* %6
%31 = load i32*, i32** %4
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
store i32 %30, i32* %34
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 2
br i1 %38, label %39, label %40
39: ; preds = %29
br label %45
40: ; preds = %29
br label %41
41: ; preds = %40, %24
br label %42
42: ; preds = %41, %23
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %12
45: ; preds = %39, %12
ret void
}

LLVM IR (-O2):
define void @Controls_GetKeyAssignment(i8* %0, i32* nocapture writeonly %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i32, i32* %1, i64 1
store i32 -1, i32* %5
store i32 -1, i32* %1
br label %6
6: ; preds = %2, %19
%7 = phi i32 [ 0, %2 ], [ %21, %19 ]
%8 = phi i32 [ 0, %2 ], [ %20, %19 ]
%9 = call i32 @trap_Key_GetBindingBuf(i32 %7, i8* %4, i32 256)
%10 = load i8, i8* %4
%11 = icmp eq i8 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %6
%13 = call i32 @Q_stricmp(i8* %4, i8* %0)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = zext i32 %8 to i64
%17 = getelementptr inbounds i32, i32* %1, i64 %16
store i32 %7, i32* %17
%18 = icmp eq i32 %8, 1
br i1 %18, label %23, label %19
19: ; preds = %12, %15, %6
%20 = phi i32 [ %8, %6 ], [ %8, %12 ], [ 1, %15 ]
%21 = add nuw nsw i32 %7, 1
%22 = icmp eq i32 %21, 256
br i1 %22, label %23, label %6
23: ; preds = %15, %19
ret void
}