#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*/ iFunCopyString(char *, char *);
int iFunGetLine(char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  char cArrayGet[1000];
  char cArrayLongest[1000];
  memset(cArrayGet, 0, 1000);
  memset(cArrayLongest, 0, 1000);
  int iLongestLen = 0;
  int iGetLen = 0;
  printf("Now, please input some words:\n");
  while ((iGetLen = iFunGetLine(cArrayGet, 1000)) > 0) {
    printf("string cArrayGet is\n%s", cArrayGet);
    if (iGetLen > iLongestLen) {
      iLongestLen = iGetLen;
      iFunCopyString(cArrayLongest, cArrayGet);
    }
  }
  printf("The longest line is %s\nthere %d words in the string.\n",
         cArrayLongest, iLongestLen);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1040 <memset@plt>
lea    -0x7f0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1040 <memset@plt>
movl   $0x0,-0x7f4(%rbp)
movl   $0x0,-0x7f8(%rbp)
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <iFunGetLine@plt>
mov    %eax,-0x7f8(%rbp)
cmp    $0x0,%eax
jle    120c <main+0xcc>
lea    -0x400(%rbp),%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x7f8(%rbp),%eax
cmp    -0x7f4(%rbp),%eax
jle    1207 <main+0xc7>
mov    -0x7f8(%rbp),%eax
mov    %eax,-0x7f4(%rbp)
lea    -0x7f0(%rbp),%rdi
lea    -0x400(%rbp),%rsi
call   1060 <iFunCopyString@plt>
jmp    11a1 <main+0x61>
lea    -0x7f0(%rbp),%rsi
mov    -0x7f4(%rbp),%edx
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x7e0,%rsp
lea    0x3f0(%rsp),%rbx
xor    %r15d,%r15d
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1050 <memset@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1050 <memset@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1060 <iFunGetLine@plt>
test   %eax,%eax
jle    11f5 <main+0xa5>
mov    %eax,%ebp
lea    0xe52(%rip),%r14
lea    0x3f0(%rsp),%rbx
mov    %rsp,%r12
xor    %r15d,%r15d
jmp    11d3 <main+0x83>
xchg   %ax,%ax
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1060 <iFunGetLine@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    11f5 <main+0xa5>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r15d,%ebp
jle    11c0 <main+0x70>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <iFunCopyString@plt>
mov    %ebp,%r15d
jmp    11c0 <main+0x70>
lea    0xe1b(%rip),%rdi
mov    %rsp,%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Now, please input some words:\0A\00"
@.str.1 = [23 x i8] c"string cArrayGet is\0A%s\00"
@.str.2 = [54 x i8] c"The longest line is %s\0Athere %d words in the string.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000 x i8]
%7 = alloca [1000 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%11 = call i32 @memset(i8* %10, i32 0, i32 1000)
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%13 = call i32 @memset(i8* %12, i32 0, i32 1000)
store i32 0, i32* %8
store i32 0, i32* %9
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %30, %2
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%17 = call i32 @iFunGetLine(i8* %16, i32 1000)
store i32 %17, i32* %9
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %31
19: ; preds = %15
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = load i32, i32* %9
%23 = load i32, i32* %8
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %30
25: ; preds = %19
%26 = load i32, i32* %9
store i32 %26, i32* %8
%27 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%29 = call i32 @iFunCopyString(i8* %27, i8* %28)
br label %30
30: ; preds = %25, %19
br label %15
31: ; preds = %15
%32 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%33 = load i32, i32* %8
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i8* %32, i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"string cArrayGet is\0A%s\00"
@.str.2 = [54 x i8] c"The longest line is %s\0Athere %d words in the string.\0A\00"
@str = [30 x i8] c"Now, please input some words:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%7 = call i32 @memset(i8* %5, i32 0, i32 1000)
%8 = call i32 @memset(i8* %6, i32 0, i32 1000)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%10 = call i32 @iFunGetLine(i8* %5, i32 1000)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %23
12: ; preds = %2, %19
%13 = phi i32 [ %21, %19 ], [ %10, %2 ]
%14 = phi i32 [ %20, %19 ], [ 0, %2 ]
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%16 = icmp sgt i32 %13, %14
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 @iFunCopyString(i8* %6, i8* %5)
br label %19
19: ; preds = %17, %12
%20 = phi i32 [ %13, %17 ], [ %14, %12 ]
%21 = call i32 @iFunGetLine(i8* %5, i32 1000)
%22 = icmp sgt i32 %21, 0
br i1 %22, label %12, label %23
23: ; preds = %19, %2
%24 = phi i32 [ 0, %2 ], [ %20, %19 ]
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0), i8* %6, i32 %24)
ret i32 0
}