#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*/ cache_clear_cache(int, char **);
int /*<<< orphan*/ cache_list_cache();
int /*<<< orphan*/ output(int, char *, char *);
int str2task(char *);
void cache_task(char *taskname, int argc, char *argv[]) {
  int task;
  output(10, "task: %s\n", taskname);
  task = str2task(taskname);
  switch (task) {
  case 2:
    cache_clear_cache(argc, argv);
    break;
  case 1:
    cache_list_cache();
    break;
  default:
    output(1, "Unknown cache task: %s\n", taskname);
  }
}


x86 assembly (clang, -O0):
<cache_task>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xeb0(%rip),%rsi
mov    $0xa,%edi
call   1030 <output@plt>
mov    -0x8(%rbp),%rdi
call   1040 <str2task@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x1,%eax
je     11aa <cache_task+0x6a>
jmp    1188 <cache_task+0x48>
mov    -0x20(%rbp),%eax
sub    $0x2,%eax
jne    11b6 <cache_task+0x76>
jmp    1199 <cache_task+0x59>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1060 <cache_clear_cache@plt>
jmp    11cb <cache_task+0x8b>
mov    $0x0,%al
call   1050 <cache_list_cache@plt>
jmp    11cb <cache_task+0x8b>
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xe3a(%rip),%rsi
call   1030 <output@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cache_task>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xebb(%rip),%rsi
mov    $0xa,%edi
mov    %rbx,%rdx
call   1030 <output@plt>
mov    %rbx,%rdi
call   1040 <str2task@plt>
cmp    $0x1,%eax
je     1180 <cache_task+0x40>
cmp    $0x2,%eax
jne    118b <cache_task+0x4b>
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <cache_clear_cache@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <cache_list_cache@plt>
lea    0xe6e(%rip),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <output@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"task: %s\0A\00"
@.str.1 = [24 x i8] c"Unknown cache task: %s\0A\00"
define void @cache_task(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%8 = load i8*, i8** %4
%9 = call i32 @output(i32 10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %4
%11 = call i32 @str2task(i8* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
switch i32 %12, label %19 [
i32 2, label %13
i32 1, label %17
]
13: ; preds = %3
%14 = load i32, i32* %5
%15 = load i8**, i8*** %6
%16 = call i32 @cache_clear_cache(i32 %14, i8** %15)
br label %22
17: ; preds = %3
%18 = call i32 (...) @cache_list_cache()
br label %22
19: ; preds = %3
%20 = load i8*, i8** %4
%21 = call i32 @output(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %19, %17, %13
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"task: %s\0A\00"
@.str.1 = [24 x i8] c"Unknown cache task: %s\0A\00"
define void @cache_task(i8* %0, i32 %1, i8** %2) {
%4 = tail call i32 @output(i32 10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 @str2task(i8* %0)
switch i32 %5, label %10 [
i32 2, label %6
i32 1, label %8
]
6: ; preds = %3
%7 = tail call i32 @cache_clear_cache(i32 %1, i8** %2)
br label %12
8: ; preds = %3
%9 = tail call i32 (...) @cache_list_cache()
br label %12
10: ; preds = %3
%11 = tail call i32 @output(i32 1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %10, %8, %6
ret void
}