#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*/ Get_text(char **, int *);
int /*<<< orphan*/ Tokenize(char **, int, int);
int /*<<< orphan*/ Usage(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *);
int strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  int thread_count, i;
  char *lines[1000];
  int line_count;
  if (argc != 2)
    Usage(argv[0]);
  thread_count = strtol(argv[1], NULL, 10);
  printf("Enter text\n");
  Get_text(lines, &line_count);
  Tokenize(lines, line_count, thread_count);
  for (i = 0; i < line_count; i++)
    if (lines[i] != NULL)
      free(lines[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     118f <main+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <Usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x14(%rbp)
lea    0xe51(%rip),%rdi
call   1050 <printf@plt>
lea    -0x1f60(%rbp),%rdi
lea    -0x1f64(%rbp),%rsi
call   1060 <Get_text@plt>
lea    -0x1f60(%rbp),%rdi
mov    -0x1f64(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <Tokenize@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1f64(%rbp),%eax
jge    1229 <main+0xc9>
movslq -0x18(%rbp),%rax
cmpq   $0x0,-0x1f60(%rbp,%rax,8)
je     1216 <main+0xb6>
movslq -0x18(%rbp),%rax
mov    -0x1f60(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
jmp    121b <main+0xbb>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11e3 <main+0x83>
xor    %eax,%eax
add    $0x1f70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1f58,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
je     117a <main+0x1a>
mov    (%rbx),%rdi
call   1070 <Usage@plt>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,%ebx
lea    0xe6d(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1060 <Get_text@plt>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
mov    %ebx,%edx
call   1050 <Tokenize@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11f1 <main+0x91>
xor    %ebx,%ebx
jmp    11dc <main+0x7c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    11f1 <main+0x91>
mov    0x10(%rsp,%rbx,8),%rdi
test   %rdi,%rdi
je     11d0 <main+0x70>
call   1030 <free@plt>
mov    0xc(%rsp),%eax
jmp    11d0 <main+0x70>
xor    %eax,%eax
add    $0x1f58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Enter text\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1000 x i8*]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @Usage(i8* %15)
br label %17
17: ; preds = %12, %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @strtol(i8* %20, i32* null, i32 10)
store i32 %21, i32* %6
%22 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%23 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %8, i64 0, i64 0
%24 = call i32 @Get_text(i8** %23, i32* %9)
%25 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %8, i64 0, i64 0
%26 = load i32, i32* %9
%27 = load i32, i32* %6
%28 = call i32 @Tokenize(i8** %25, i32 %26, i32 %27)
store i32 0, i32* %7
br label %29
29: ; preds = %46, %17
%30 = load i32, i32* %7
%31 = load i32, i32* %9
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %49
33: ; preds = %29
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %8, i64 0, i64 %35
%37 = load i8*, i8** %36
%38 = icmp ne i8* %37, null
br i1 %38, label %39, label %45
39: ; preds = %33
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %8, i64 0, i64 %41
%43 = load i8*, i8** %42
%44 = call i32 @free(i8* %43)
br label %45
45: ; preds = %39, %33
br label %46
46: ; preds = %45
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %29
49: ; preds = %29
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"Enter text\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1000 x i8*]
%4 = alloca i32
%5 = bitcast [1000 x i8*]* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %0, 2
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 @Usage(i8* %9)
br label %11
11: ; preds = %8, %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @strtol(i8* nocapture %13, i32* null, i32 10)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%16 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %3, i64 0, i64 0
%17 = call i32 @Get_text(i8** %16, i32* %4)
%18 = load i32, i32* %4
%19 = call i32 @Tokenize(i8** %16, i32 %18, i32 %14)
%20 = load i32, i32* %4
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %36
22: ; preds = %11, %31
%23 = phi i32 [ %32, %31 ], [ %20, %11 ]
%24 = phi i64 [ %33, %31 ], [ 0, %11 ]
%25 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %3, i64 0, i64 %24
%26 = load i8*, i8** %25
%27 = icmp eq i8* %26, null
br i1 %27, label %31, label %28
28: ; preds = %22
%29 = call i32 @free(i8* %26)
%30 = load i32, i32* %4
br label %31
31: ; preds = %22, %28
%32 = phi i32 [ %23, %22 ], [ %30, %28 ]
%33 = add nuw nsw i64 %24, 1
%34 = sext i32 %32 to i64
%35 = icmp slt i64 %33, %34
br i1 %35, label %22, label %36
36: ; preds = %31, %11
ret i32 0
}