#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__ strmi(char *, char *);
int /*<<< orphan*/ syntax_err(int, char *);
int check_cmdstr(int line, char *cmd) {
  if (strmi(cmd, "set"))
    return 1;
  if (strmi(cmd, "add"))
    return 1;
  if (strmi(cmd, "die"))
    return 1;
  syntax_err(line, "Invalid command");
  return 0;
}


x86 assembly (clang, -O0):
<check_cmdstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strmi@plt>
cmp    $0x0,%rax
je     1155 <check_cmdstr+0x35>
movl   $0x1,-0x4(%rbp)
jmp    11b7 <check_cmdstr+0x97>
mov    -0x10(%rbp),%rdi
lea    0xea4(%rip),%rsi
call   1030 <strmi@plt>
cmp    $0x0,%rax
je     117b <check_cmdstr+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    11b7 <check_cmdstr+0x97>
mov    -0x10(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strmi@plt>
cmp    $0x0,%rax
je     11a1 <check_cmdstr+0x81>
movl   $0x1,-0x4(%rbp)
jmp    11b7 <check_cmdstr+0x97>
mov    -0x8(%rbp),%edi
lea    0xe61(%rip),%rsi
call   1040 <syntax_err@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_cmdstr>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
lea    0xecf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strmi@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    117c <check_cmdstr+0x5c>
lea    0xeba(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strmi@plt>
test   %rax,%rax
jne    117c <check_cmdstr+0x5c>
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strmi@plt>
test   %rax,%rax
jne    117c <check_cmdstr+0x5c>
lea    0xe9a(%rip),%rsi
mov    %r14d,%edi
call   1040 <syntax_err@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"set\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [4 x i8] c"die\00"
@.str.3 = [16 x i8] c"Invalid command\00"
define i32 @check_cmdstr(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i64 @strmi(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 1, i32* %3
br label %23
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call i64 @strmi(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %3
br label %23
15: ; preds = %10
%16 = load i8*, i8** %5
%17 = call i64 @strmi(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 1, i32* %3
br label %23
20: ; preds = %15
%21 = load i32, i32* %4
%22 = call i32 @syntax_err(i32 %21, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %23
23: ; preds = %20, %19, %14, %9
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [4 x i8] c"set\00"
@.str.1 = [4 x i8] c"add\00"
@.str.2 = [4 x i8] c"die\00"
@.str.3 = [16 x i8] c"Invalid command\00"
define i32 @check_cmdstr(i32 %0, i8* %1) {
%3 = tail call i64 @strmi(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %2
%6 = tail call i64 @strmi(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = tail call i64 @strmi(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @syntax_err(i32 %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %8, %5, %2, %11
%14 = phi i32 [ 0, %11 ], [ 1, %2 ], [ 1, %5 ], [ 1, %8 ]
ret i32 %14
}