#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ TDB_cmd_help(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
scalar_t__ strncmp(char *, char *, int);
void TDB_cmd_task(char *cmd) {
  if (strncmp(cmd, "help", 4) == 0) {
    TDB_cmd_help(cmd);
  } else if (strncmp(cmd, "exit", 4) == 0) {
    exit(EXIT_SUCCESS);
  } else {
    printf("Unknown command. Try 'help'.\n");
  }
}


x86 assembly (clang, -O0):
<TDB_cmd_task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1179 <TDB_cmd_task+0x39>
mov    -0x8(%rbp),%rdi
call   1040 <TDB_cmd_help@plt>
jmp    11b7 <TDB_cmd_task+0x77>
mov    -0x8(%rbp),%rdi
lea    0xe81(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a6 <TDB_cmd_task+0x66>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
lea    0xe5d(%rip),%rdi
call   1050 <printf@plt>
jmp    11b7 <TDB_cmd_task+0x77>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TDB_cmd_task>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1180 <TDB_cmd_task+0x40>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1189 <TDB_cmd_task+0x49>
lea    0xe90(%rip),%rdi
pop    %rbx
jmp    1050 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <TDB_cmd_help@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"help\00"
@.str.1 = [5 x i8] c"exit\00"
@EXIT_SUCCESS = global i32 0
@.str.2 = [30 x i8] c"Unknown command. Try 'help'.\0A\00"
define void @TDB_cmd_task(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @TDB_cmd_help(i8* %7)
br label %19
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* @EXIT_SUCCESS
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %9
%17 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16
br label %19
19: ; preds = %18, %6
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"help\00"
@.str.1 = [5 x i8] c"exit\00"
@EXIT_SUCCESS = global i32 0
@str = [29 x i8] c"Unknown command. Try 'help'.\00"
define void @TDB_cmd_task(i8* %0) {
%2 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @TDB_cmd_help(i8* %0)
br label %14
6: ; preds = %1
%7 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* @EXIT_SUCCESS
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %6
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %12, %4
ret void
}