#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*/ free(char *);
int /*<<< orphan*/ handle_task(int, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int main(int argc, char **argv) {
  char *input = (char *)malloc(sizeof(char) * 100 + 1);
  for (int i = 0; i < argc - 1; i++) {
    printf("Enter Solution for task %d:", i);
    scanf("%s", input);
    handle_task(i, input);
  }
  free(input);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x65,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11c5 <main+0x75>
mov    -0x1c(%rbp),%esi
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe76(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <handle_task@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117b <main+0x2b>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r14d
mov    $0x65,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
cmp    $0x2,%r14d
jl     11b7 <main+0x67>
add    $0xffffffff,%r14d
xor    %ebp,%ebp
lea    0xe85(%rip),%r15
lea    0xe9a(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <handle_task@plt>
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1190 <main+0x40>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Enter Solution for task %d:\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i64 @malloc(i32 101)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %6
store i32 0, i32* %7
br label %10
10: ; preds = %23, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 1
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %26
15: ; preds = %10
%16 = load i32, i32* %7
%17 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i8*, i8** %6
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = load i32, i32* %7
%21 = load i8*, i8** %6
%22 = call i32 @handle_task(i32 %20, i8* %21)
br label %23
23: ; preds = %15
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %10
26: ; preds = %10
%27 = load i8*, i8** %6
%28 = call i32 @free(i8* %27)
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [28 x i8] c"Enter Solution for task %d:\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 101)
%4 = inttoptr i64 %3 to i8*
%5 = add i32 %0, -1
%6 = icmp sgt i32 %0, 1
br i1 %6, label %9, label %7
7: ; preds = %9, %2
%8 = tail call i32 @free(i8* %4)
ret i32 0
9: ; preds = %2, %9
%10 = phi i32 [ %14, %9 ], [ 0, %2 ]
%11 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%13 = tail call i32 @handle_task(i32 %10, i8* %4)
%14 = add nuw nsw i32 %10, 1
%15 = icmp eq i32 %14, %5
br i1 %15, label %7, label %9
}