#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 */
char **div_str(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ free_list(char **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  char str[50];
  char **ws;
  int i;
  printf("Input the line pls:");
  fgets(str, 50, stdin);
  ws = div_str(str);
  for (i = 0; ws[i]; i++) {
    printf("%s\n", ws[i]);
  }
  free_list(ws);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    0x2e79(%rip),%rax
mov    (%rax),%edx
mov    $0x32,%esi
call   1040 <fgets@plt>
lea    -0x50(%rbp),%rdi
call   1060 <div_str@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x58(%rbp),%rax
movslq -0x5c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11ca <main+0x8a>
mov    -0x58(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    118f <main+0x4f>
mov    -0x58(%rbp),%rdi
call   1050 <free_list@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x32,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1070 <div_str@plt>
mov    %rax,%r14
mov    (%rax),%rdi
test   %rdi,%rdi
je     11b1 <main+0x61>
mov    %r14,%rbx
add    $0x8,%rbx
nopl   0x0(%rax,%rax,1)
call   1030 <puts@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    11a0 <main+0x50>
mov    %r14,%rdi
call   1060 <free_list@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Input the line pls:\00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [50 x i8]
%7 = alloca i8**
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 50, i32 %11)
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%14 = call i8** @div_str(i8* %13)
store i8** %14, i8*** %7
store i32 0, i32* %8
br label %15
15: ; preds = %29, %2
%16 = load i8**, i8*** %7
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %32
22: ; preds = %15
%23 = load i8**, i8*** %7
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %22
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %15
32: ; preds = %15
%33 = load i8**, i8*** %7
%34 = call i32 @free_list(i8** %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Input the line pls:\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %4, i32 50, i32 %6)
%8 = call i8** @div_str(i8* %4)
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %19, label %11
11: ; preds = %2, %11
%12 = phi i64 [ %15, %11 ], [ 0, %2 ]
%13 = phi i8* [ %17, %11 ], [ %9, %2 ]
%14 = call i32 @puts(i8* %13)
%15 = add nuw i64 %12, 1
%16 = getelementptr inbounds i8*, i8** %8, i64 %15
%17 = load i8*, i8** %16
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %11
19: ; preds = %11, %2
%20 = call i32 @free_list(i8** %8)
ret i32 0
}