#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*/ build_command_key(char *, char *);
int /*<<< orphan*/ mu_fail(char *);
scalar_t__ strcmp(char *, char *);
void test_build_command_key() {
  char key[50];
  build_command_key(key, "cmd");
  do {
    if (!((strcmp(key, "PRIVMSG#cmd") == 0))) {
      mu_fail("test_build_command_key: key should be 'PRIVMSG#cmd'");
      return;
    }
  } while (0);
  build_command_key(key, "");
  do {
    if (!((strcmp(key, "PRIVMSG#") == 0))) {
      mu_fail("test_build_command_key: key should be 'PRIVMSG#'");
      return;
    }
  } while (0);
}


x86 assembly (clang, -O0):
<test_build_command_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x40(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1050 <build_command_key@plt>
lea    -0x40(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1173 <test_build_command_key+0x43>
lea    0xea3(%rip),%rdi
call   1040 <mu_fail@plt>
jmp    11b8 <test_build_command_key+0x88>
jmp    1178 <test_build_command_key+0x48>
lea    -0x40(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1050 <build_command_key@plt>
lea    -0x40(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     11b3 <test_build_command_key+0x83>
lea    0xea0(%rip),%rdi
call   1040 <mu_fail@plt>
jmp    11b8 <test_build_command_key+0x88>
jmp    11b8 <test_build_command_key+0x88>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_build_command_key>:
push   %rbx
sub    $0x40,%rsp
lea    0xecc(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <build_command_key@plt>
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1164 <test_build_command_key+0x34>
lea    0xeaa(%rip),%rdi
jmp    1191 <test_build_command_key+0x61>
lea    0xedd(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <build_command_key@plt>
lea    0xec3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1196 <test_build_command_key+0x66>
lea    0xeb8(%rip),%rdi
call   1040 <mu_fail@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cmd\00"
@.str.1 = [12 x i8] c"PRIVMSG#cmd\00"
@.str.2 = [52 x i8] c"test_build_command_key: key should be 'PRIVMSG#cmd'\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [9 x i8] c"PRIVMSG#\00"
@.str.5 = [49 x i8] c"test_build_command_key: key should be 'PRIVMSG#'\00"
define void @test_build_command_key() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @build_command_key(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%6 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = call i32 @mu_fail(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
br label %21
10: ; preds = %4
br label %11
11: ; preds = %10
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%13 = call i32 @build_command_key(i8* %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
br label %14
14: ; preds = %11
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = call i32 @mu_fail(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
br label %21
20: ; preds = %14
br label %21
21: ; preds = %8, %18, %20
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"cmd\00"
@.str.1 = [12 x i8] c"PRIVMSG#cmd\00"
@.str.2 = [52 x i8] c"test_build_command_key: key should be 'PRIVMSG#cmd'\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [9 x i8] c"PRIVMSG#\00"
@.str.5 = [49 x i8] c"test_build_command_key: key should be 'PRIVMSG#'\00"
define void @test_build_command_key() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @build_command_key(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i32 @build_command_key(i8* %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%8 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %6, %0
%11 = phi i8* [ getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), %0 ], [ getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), %6 ]
%12 = call i32 @mu_fail(i8* %11)
br label %13
13: ; preds = %10, %6
ret void
}