#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ clear_string(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
void get_numbered_line_of_file(char line[155], int number) {
  int i = 0;
  char temp[155];
  FILE *f = fopen("keywords", "r");
  for (i = 0; i < number; i++) {
    clear_string(temp);
    fgets(temp, 155, f);
  };
  temp[strlen(temp) - 1] = ' ';
  printf("lenght of string temp = %d;\n", strlen(temp));
  printf("temp [ strlen ( temp ) = %d - 1 ] = '%c';\n", strlen(temp) - 1,
         temp[strlen(temp) - 1]);
  printf("after cycle position = %d; and getted string = %s;\n", i, temp);
  strcat(line, temp);
  fclose(f);
}


x86 assembly (clang, -O0):
<get_numbered_line_of_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe70(%rip),%rdi
lea    0xe72(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0xb8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e8 <get_numbered_line_of_file+0x78>
lea    -0xb0(%rbp),%rdi
call   1030 <clear_string@plt>
lea    -0xb0(%rbp),%rdi
mov    -0xb8(%rbp),%rdx
mov    $0x9b,%esi
call   1070 <fgets@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11aa <get_numbered_line_of_file+0x3a>
lea    -0xb0(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x20,-0xb0(%rbp,%rax,1)
lea    -0xb0(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%esi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xb0(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xbc(%rbp)
lea    -0xb0(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xbc(%rbp),%esi
sub    $0x1,%eax
cltq
movsbl -0xb0(%rbp,%rax,1),%edx
ff
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%esi
lea    -0xb0(%rbp),%rdx
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1090 <strcat@plt>
mov    -0xb8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_numbered_line_of_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %esi,%r15d
mov    %rdi,%r14
lea    0xe72(%rip),%rdi
lea    0xe74(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r13
test   %r15d,%r15d
jle    11cf <get_numbered_line_of_file+0x5f>
mov    %rsp,%rbp
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1030 <clear_string@plt>
mov    %rbp,%rdi
mov    $0x9b,%esi
mov    %r13,%rdx
call   1070 <fgets@plt>
add    $0xffffffff,%ebx
jne    11b0 <get_numbered_line_of_file+0x40>
jmp    11d2 <get_numbered_line_of_file+0x62>
xor    %r15d,%r15d
mov    %rsp,%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x20,-0x1(%rax,%rbp,1)
mov    %rbp,%rdi
call   1050 <strlen@plt>
lea    0xe18(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
lea    -0x1(%rax),%r12d
mov    %rbp,%rdi
call   1050 <strlen@plt>
cltq
movsbl -0x1(%rax,%rbp,1),%edx
lea    0xe0a(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe24(%rip),%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1090 <strcat@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"keywords\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"lenght of string temp = %d;\0A\00"
@.str.3 = [43 x i8] c"temp [ strlen ( temp ) = %d - 1 ] = '%c';\0A\00"
@.str.4 = [52 x i8] c"after cycle position = %d; and getted string = %s;\0A\00"
define void @get_numbered_line_of_file(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [155 x i8]
%7 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%8 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %7
store i32 0, i32* %5
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = getelementptr inbounds [155 x i8], [155 x i8]* %6, i64 0, i64 0
%15 = call i32 @clear_string(i8* %14)
%16 = getelementptr inbounds [155 x i8], [155 x i8]* %6, i64 0, i64 0
%17 = load i32*, i32** %7
%18 = call i32 @fgets(i8* %16, i32 155, i32* %17)
br label %19
19: ; preds = %13
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %9
22: ; preds = %9
%23 = getelementptr inbounds [155 x i8], [155 x i8]* %6, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [155 x i8], [155 x i8]* %6, i64 0, i64 %26
store i8 32, i8* %27
%28 = getelementptr inbounds [155 x i8], [155 x i8]* %6, i64 0, i64 0
%29 = call i32 @strlen(i8* %28)
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [155 x i8], [155 x i8]* %6, i64 0, i64 0
%32 = call i32 @strlen(i8* %31)
%33 = sub nsw i32 %32, 1
%34 = getelementptr inbounds [155 x i8], [155 x i8]* %6, i64 0, i64 0
%35 = call i32 @strlen(i8* %34)
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [155 x i8], [155 x i8]* %6, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %33, i32 %40)
%42 = load i32, i32* %5
%43 = getelementptr inbounds [155 x i8], [155 x i8]* %6, i64 0, i64 0
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %42, i8* %43)
%45 = load i8*, i8** %3
%46 = getelementptr inbounds [155 x i8], [155 x i8]* %6, i64 0, i64 0
%47 = call i32 @strcat(i8* %45, i8* %46)
%48 = load i32*, i32** %7
%49 = call i32 @fclose(i32* %48)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"keywords\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"lenght of string temp = %d;\0A\00"
@.str.3 = [43 x i8] c"temp [ strlen ( temp ) = %d - 1 ] = '%c';\0A\00"
@.str.4 = [52 x i8] c"after cycle position = %d; and getted string = %s;\0A\00"
define void @get_numbered_line_of_file(i8* %0, i32 %1) {
%3 = alloca [155 x i8]
%4 = getelementptr inbounds [155 x i8], [155 x i8]* %3, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %13
7: ; preds = %2, %7
%8 = phi i32 [ %11, %7 ], [ 0, %2 ]
%9 = call i32 @clear_string(i8* %4)
%10 = call i32 @fgets(i8* %4, i32 155, i32* %5)
%11 = add nuw nsw i32 %8, 1
%12 = icmp eq i32 %11, %1
br i1 %12, label %13, label %7
13: ; preds = %7, %2
%14 = phi i32 [ 0, %2 ], [ %1, %7 ]
%15 = call i32 @strlen(i8* %4)
%16 = add nsw i32 %15, -1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [155 x i8], [155 x i8]* %3, i64 0, i64 %17
store i8 32, i8* %18
%19 = call i32 @strlen(i8* %4)
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = call i32 @strlen(i8* %4)
%22 = add nsw i32 %21, -1
%23 = call i32 @strlen(i8* %4)
%24 = add nsw i32 %23, -1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [155 x i8], [155 x i8]* %3, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %22, i32 %28)
%30 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i32 %14, i8* %4)
%31 = call i32 @strcat(i8* %0, i8* %4)
%32 = call i32 @fclose(i32* %5)
ret void
}