#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__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
char *select_task(char **, int, int);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  int i;
  char **tasks = (char **)malloc(10 * 16 * sizeof(char));
  for (i = 0; i < 10; i++)
    tasks[i] = (char *)malloc(16 * sizeof(char));
  strcpy(tasks[0], "a");
  strcpy(tasks[1], "b");
  strcpy(tasks[2], "c");
  strcpy(tasks[3], "d");
  strcpy(tasks[4], "e");
  strcpy(tasks[5], "f");
  strcpy(tasks[6], "g");
  strcpy(tasks[7], "h");
  strcpy(tasks[8], "i");
  strcpy(tasks[9], "j");
  printf("\ntask selected: %s\n", select_task(tasks, 10, 8));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa0,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1195 <main+0x55>
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x24>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe5d(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4b(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe39(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe27(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xe15(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
lea    0xe03(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
lea    0xdf1(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
lea    0xddf(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x40(%rax),%rdi
lea    0xdcd(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x48(%rax),%rdi
lea    0xdbb(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
mov    $0x8,%edx
call   1060 <select_task@plt>
mov    %rax,%rsi
lea    0xd9b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa0,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,(%rbx)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x10(%rbx)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x18(%rbx)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x20(%rbx)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x28(%rbx)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x30(%rbx)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x38(%rbx)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x40(%rbx)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x48(%rbx)
mov    (%rbx),%rdi
lea    0xe1d(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x8(%rbx),%rdi
lea    0xe0f(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x10(%rbx),%rdi
lea    0xe01(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x18(%rbx),%rdi
lea    0xdf3(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x20(%rbx),%rdi
lea    0xde5(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x28(%rbx),%rdi
lea    0xdd7(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x30(%rbx),%rdi
lea    0xdc9(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x38(%rbx),%rdi
lea    0xdbb(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x40(%rbx),%rdi
lea    0xdad(%rip),%rsi
call   1030 <strcpy@plt>
mov    0x48(%rbx),%rdi
lea    0xd9f(%rip),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x8,%edx
call   1060 <select_task@plt>
lea    0xd83(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [2 x i8] c"b\00"
@.str.2 = [2 x i8] c"c\00"
@.str.3 = [2 x i8] c"d\00"
@.str.4 = [2 x i8] c"e\00"
@.str.5 = [2 x i8] c"f\00"
@.str.6 = [2 x i8] c"g\00"
@.str.7 = [2 x i8] c"h\00"
@.str.8 = [2 x i8] c"i\00"
@.str.9 = [2 x i8] c"j\00"
@.str.10 = [20 x i8] c"\0Atask selected: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8**
store i32 0, i32* %1
%4 = call i64 @malloc(i32 160)
%5 = inttoptr i64 %4 to i8**
store i8** %5, i8*** %3
store i32 0, i32* %2
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = call i64 @malloc(i32 16)
%11 = inttoptr i64 %10 to i8*
%12 = load i8**, i8*** %3
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
store i8* %11, i8** %15
br label %16
16: ; preds = %9
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %6
19: ; preds = %6
%20 = load i8**, i8*** %3
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = load i8**, i8*** %3
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @strcpy(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%28 = load i8**, i8*** %3
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = call i32 @strcpy(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%32 = load i8**, i8*** %3
%33 = getelementptr inbounds i8*, i8** %32, i64 3
%34 = load i8*, i8** %33
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%36 = load i8**, i8*** %3
%37 = getelementptr inbounds i8*, i8** %36, i64 4
%38 = load i8*, i8** %37
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%40 = load i8**, i8*** %3
%41 = getelementptr inbounds i8*, i8** %40, i64 5
%42 = load i8*, i8** %41
%43 = call i32 @strcpy(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%44 = load i8**, i8*** %3
%45 = getelementptr inbounds i8*, i8** %44, i64 6
%46 = load i8*, i8** %45
%47 = call i32 @strcpy(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%48 = load i8**, i8*** %3
%49 = getelementptr inbounds i8*, i8** %48, i64 7
%50 = load i8*, i8** %49
%51 = call i32 @strcpy(i8* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%52 = load i8**, i8*** %3
%53 = getelementptr inbounds i8*, i8** %52, i64 8
%54 = load i8*, i8** %53
%55 = call i32 @strcpy(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%56 = load i8**, i8*** %3
%57 = getelementptr inbounds i8*, i8** %56, i64 9
%58 = load i8*, i8** %57
%59 = call i32 @strcpy(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%60 = load i8**, i8*** %3
%61 = call i8* @select_task(i8** %60, i32 10, i32 8)
%62 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %61)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [2 x i8] c"b\00"
@.str.2 = [2 x i8] c"c\00"
@.str.3 = [2 x i8] c"d\00"
@.str.4 = [2 x i8] c"e\00"
@.str.5 = [2 x i8] c"f\00"
@.str.6 = [2 x i8] c"g\00"
@.str.7 = [2 x i8] c"h\00"
@.str.8 = [2 x i8] c"i\00"
@.str.9 = [2 x i8] c"j\00"
@.str.10 = [20 x i8] c"\0Atask selected: %s\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 160)
%2 = inttoptr i64 %1 to i8**
%3 = tail call i64 @malloc(i32 16)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = tail call i64 @malloc(i32 16)
%6 = inttoptr i64 %5 to i8*
%7 = getelementptr inbounds i8*, i8** %2, i64 1
store i8* %6, i8** %7
%8 = tail call i64 @malloc(i32 16)
%9 = inttoptr i64 %8 to i8*
%10 = getelementptr inbounds i8*, i8** %2, i64 2
store i8* %9, i8** %10
%11 = tail call i64 @malloc(i32 16)
%12 = inttoptr i64 %11 to i8*
%13 = getelementptr inbounds i8*, i8** %2, i64 3
store i8* %12, i8** %13
%14 = tail call i64 @malloc(i32 16)
%15 = inttoptr i64 %14 to i8*
%16 = getelementptr inbounds i8*, i8** %2, i64 4
store i8* %15, i8** %16
%17 = tail call i64 @malloc(i32 16)
%18 = inttoptr i64 %17 to i8*
%19 = getelementptr inbounds i8*, i8** %2, i64 5
store i8* %18, i8** %19
%20 = tail call i64 @malloc(i32 16)
%21 = inttoptr i64 %20 to i8*
%22 = getelementptr inbounds i8*, i8** %2, i64 6
store i8* %21, i8** %22
%23 = tail call i64 @malloc(i32 16)
%24 = inttoptr i64 %23 to i8*
%25 = getelementptr inbounds i8*, i8** %2, i64 7
store i8* %24, i8** %25
%26 = tail call i64 @malloc(i32 16)
%27 = inttoptr i64 %26 to i8*
%28 = getelementptr inbounds i8*, i8** %2, i64 8
store i8* %27, i8** %28
%29 = tail call i64 @malloc(i32 16)
%30 = inttoptr i64 %29 to i8*
%31 = getelementptr inbounds i8*, i8** %2, i64 9
store i8* %30, i8** %31
%32 = load i8*, i8** %2
%33 = tail call i32 @strcpy(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%34 = load i8*, i8** %7
%35 = tail call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%36 = load i8*, i8** %10
%37 = tail call i32 @strcpy(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%38 = load i8*, i8** %13
%39 = tail call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%40 = load i8*, i8** %16
%41 = tail call i32 @strcpy(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%42 = load i8*, i8** %19
%43 = tail call i32 @strcpy(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%44 = load i8*, i8** %22
%45 = tail call i32 @strcpy(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%46 = load i8*, i8** %25
%47 = tail call i32 @strcpy(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%48 = load i8*, i8** %28
%49 = tail call i32 @strcpy(i8* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%50 = load i8*, i8** %31
%51 = tail call i32 @strcpy(i8* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%52 = tail call i8* @select_task(i8** %2, i32 10, i32 8)
%53 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %52)
ret i32 0
}