#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 */
scalar_t__ strcmp(char *, char *);
int check_operand_for_command(char *cmd, int op_type, int op_position) {
  if (op_position == 1 && strcmp(cmd, "lea") == 0 && op_type != 1) {
    return -1;
  } else if (op_position == 2) {
    if (op_type == 0 && strcmp(cmd, "cmp") != 0 && strcmp(cmd, "prn") != 0)
      return -1;
    if (op_type == 4 && (strcmp(cmd, "jmp") == 0 || strcmp(cmd, "bne") == 0 ||
                         strcmp(cmd, "jsr") == 0))
      return -1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_operand_for_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    115c <check_operand_for_command+0x4c>
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    115c <check_operand_for_command+0x4c>
cmpl   $0x1,-0x14(%rbp)
je     115c <check_operand_for_command+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1225 <check_operand_for_command+0x115>
cmpl   $0x2,-0x18(%rbp)
jne    1219 <check_operand_for_command+0x109>
cmpl   $0x0,-0x14(%rbp)
jne    11b0 <check_operand_for_command+0xa0>
mov    -0x10(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11b0 <check_operand_for_command+0xa0>
mov    -0x10(%rbp),%rdi
lea    0xe73(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11b0 <check_operand_for_command+0xa0>
movl   $0xffffffff,-0x4(%rbp)
jmp    1225 <check_operand_for_command+0x115>
cmpl   $0x4,-0x14(%rbp)
jne    1214 <check_operand_for_command+0x104>
mov    -0x10(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1208 <check_operand_for_command+0xf8>
mov    -0x10(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1208 <check_operand_for_command+0xf8>
mov    -0x10(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1214 <check_operand_for_command+0x104>
movl   $0xffffffff,-0x4(%rbp)
jmp    1225 <check_operand_for_command+0x115>
jmp    1219 <check_operand_for_command+0x109>
jmp    121e <check_operand_for_command+0x10e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_operand_for_command>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
cmp    $0x2,%edx
je     114e <check_operand_for_command+0x3e>
cmp    $0x1,%edx
jne    11c7 <check_operand_for_command+0xb7>
lea    0xed3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
cmp    $0x1,%ebp
je     11c7 <check_operand_for_command+0xb7>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     11cc <check_operand_for_command+0xbc>
jmp    11c7 <check_operand_for_command+0xb7>
cmp    $0x4,%ebp
je     1186 <check_operand_for_command+0x76>
test   %ebp,%ebp
jne    11c7 <check_operand_for_command+0xb7>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11c7 <check_operand_for_command+0xb7>
lea    0xe96(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
jne    11cc <check_operand_for_command+0xbc>
jmp    11c7 <check_operand_for_command+0xb7>
lea    0xe7f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     11cc <check_operand_for_command+0xbc>
lea    0xe6a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11cc <check_operand_for_command+0xbc>
lea    0xe5a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11cc <check_operand_for_command+0xbc>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"lea\00"
@.str.1 = [4 x i8] c"cmp\00"
@.str.2 = [4 x i8] c"prn\00"
@.str.3 = [4 x i8] c"jmp\00"
@.str.4 = [4 x i8] c"bne\00"
@.str.5 = [4 x i8] c"jsr\00"
define i32 @check_operand_for_command(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %18
10: ; preds = %3
%11 = load i8*, i8** %5
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 -1, i32* %4
br label %52
18: ; preds = %14, %10, %3
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %50
21: ; preds = %18
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = load i8*, i8** %5
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i8*, i8** %5
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 -1, i32* %4
br label %52
33: ; preds = %28, %24, %21
%34 = load i32, i32* %6
%35 = icmp eq i32 %34, 4
br i1 %35, label %36, label %49
36: ; preds = %33
%37 = load i8*, i8** %5
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %48, label %40
40: ; preds = %36
%41 = load i8*, i8** %5
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %40
%45 = load i8*, i8** %5
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %44, %40, %36
store i32 -1, i32* %4
br label %52
49: ; preds = %44, %33
br label %50
50: ; preds = %49, %18
br label %51
51: ; preds = %50
store i32 1, i32* %4
br label %52
52: ; preds = %51, %48, %32, %17
%53 = load i32, i32* %4
ret i32 %53
}

LLVM IR (-O2):
@.str = [4 x i8] c"lea\00"
@.str.1 = [4 x i8] c"cmp\00"
@.str.2 = [4 x i8] c"prn\00"
@.str.3 = [4 x i8] c"jmp\00"
@.str.4 = [4 x i8] c"bne\00"
@.str.5 = [4 x i8] c"jsr\00"
define i32 @check_operand_for_command(i8* %0, i32 %1, i32 %2) {
switch i32 %2, label %25 [
i32 1, label %4
i32 2, label %9
]
4: ; preds = %3
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = icmp ne i32 %1, 1
%8 = and i1 %7, %6
br i1 %8, label %26, label %25
9: ; preds = %3
switch i32 %1, label %25 [
i32 0, label %10
i32 4, label %16
]
10: ; preds = %9
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %10
%14 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %25, label %26
16: ; preds = %9
%17 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %16
%20 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %10, %13, %4, %9, %3, %22
br label %26
26: ; preds = %16, %19, %22, %13, %4, %25
%27 = phi i32 [ 1, %25 ], [ -1, %4 ], [ -1, %13 ], [ -1, %22 ], [ -1, %19 ], [ -1, %16 ]
ret i32 %27
}