#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 */
#define EOF 128
char getc(int /*<<< orphan*/ *);
int GetIniLine(FILE *cIniName, char *cIniBuffer) {
  int i;
  for (i = 0; i < 1024 - 1; i++) {
    cIniBuffer[i] = getc(cIniName);
    switch (cIniBuffer[i]) {
    case EOF:
      cIniBuffer[i] = 0;
      return EOF;
    case 10:
      cIniBuffer[i] = 0;
      return 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<GetIniLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3ff,-0x1c(%rbp)
jge    11bd <GetIniLine+0xad>
mov    -0x10(%rbp),%rdi
call   1030 <getc@plt>
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
sub    $0xa,%eax
je     1192 <GetIniLine+0x82>
jmp    1167 <GetIniLine+0x57>
mov    -0x20(%rbp),%eax
sub    $0x80,%eax
jne    11aa <GetIniLine+0x9a>
jmp    117a <GetIniLine+0x6a>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x80,-0x4(%rbp)
jmp    11c4 <GetIniLine+0xb4>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x4(%rbp)
jmp    11c4 <GetIniLine+0xb4>
jmp    11af <GetIniLine+0x9f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1127 <GetIniLine+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetIniLine>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
nopl   (%rax)
mov    %r15,%rdi
call   1030 <getc@plt>
mov    %al,(%r14,%rbx,1)
cmp    $0xa,%al
je     113f <GetIniLine+0x2f>
add    $0x1,%rbx
cmp    $0x3ff,%rbx
jne    1120 <GetIniLine+0x10>
jmp    1144 <GetIniLine+0x34>
movb   $0x0,(%r14,%rbx,1)
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @GetIniLine(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 0, i32* %6
br label %7
7: ; preds = %34, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 1023
br i1 %9, label %10, label %37
10: ; preds = %7
%11 = load i32*, i32** %4
%12 = call signext i8 @getc(i32* %11)
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 %12, i8* %16
%17 = load i8*, i8** %5
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
switch i32 %22, label %33 [
i32 128, label %23
i32 10, label %28
]
23: ; preds = %10
%24 = load i8*, i8** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 0, i8* %27
store i32 128, i32* %3
br label %38
28: ; preds = %10
%29 = load i8*, i8** %5
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 0, i8* %32
store i32 0, i32* %3
br label %38
33: ; preds = %10
br label %34
34: ; preds = %33
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %7
37: ; preds = %7
store i32 0, i32* %3
br label %38
38: ; preds = %37, %28, %23
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
define i32 @GetIniLine(i32* nocapture %0, i8* nocapture writeonly %1) {
br label %3
3: ; preds = %2, %11
%4 = phi i64 [ 0, %2 ], [ %12, %11 ]
%5 = tail call signext i8 @getc(i32* %0)
%6 = getelementptr inbounds i8, i8* %1, i64 %4
store i8 %5, i8* %6
%7 = icmp eq i8 %5, 10
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = and i64 %4, 4294967295
%10 = getelementptr inbounds i8, i8* %1, i64 %9
store i8 0, i8* %10
br label %14
11: ; preds = %3
%12 = add nuw nsw i64 %4, 1
%13 = icmp eq i64 %12, 1023
br i1 %13, label %14, label %3
14: ; preds = %11, %8
ret i32 0
}