int readResLine(stream, aStr)
char *stream;
char aStr[255];
{
  static char aChar, *ptr, *sptr;
  static short int begin = 1;
  if (begin) {
    sptr = stream;
    begin = 0;
  }
  ptr = (char *)aStr;
  do {
    sscanf(sptr, "%c", &aChar);
    if (aChar == '\r')
      *ptr = '\0';
    else
      *ptr++ = aChar;
    sptr++;
  } while (aChar != '\r');
  return (1);
}


x86 assembly (clang, -O0):
<readResLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpw   $0x0,0x2f00(%rip)
je     1142 <readResLine+0x32>
mov    -0x8(%rbp),%rax
mov    %rax,0x2f0f(%rip)
movw   $0x0,0x2ee6(%rip)
mov    -0x10(%rbp),%rax
mov    %rax,0x2ef3(%rip)
mov    0x2ef4(%rip),%rdi
lea    0xea5(%rip),%rsi
lea    0x2ed6(%rip),%rdx
mov    $0x0,%al
call   1030 <sscanf@plt>
movsbl 0x2ec8(%rip),%eax
cmp    $0xd,%eax
jne    1188 <readResLine+0x78>
mov    0x2ec0(%rip),%rax
movb   $0x0,(%rax)
jmp    11a5 <readResLine+0x95>
mov    0x2eaa(%rip),%cl
mov    0x2eab(%rip),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,0x2e9d(%rip)
mov    %cl,(%rax)
mov    0x2e9c(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2e91(%rip)
movsbl 0x2e7a(%rip),%eax
cmp    $0xd,%eax
jne    114d <readResLine+0x3d>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readResLine>:
push   %rbp
push   %r14
push   %rbx
cmpb   $0x1,0x2f2d(%rip)
jne    1126 <readResLine+0x16>
mov    0x2f1c(%rip),%rdi
jmp    1134 <readResLine+0x24>
mov    %rdi,0x2f13(%rip)
movb   $0x1,0x2f14(%rip)
mov    %rsi,0x2efd(%rip)
lea    0xebe(%rip),%r14
lea    0x2ee7(%rip),%rbx
jmp    116e <readResLine+0x5e>
nopl   0x0(%rax,%rax,1)
mov    %bpl,(%rax)
mov    0x2ee6(%rip),%rdi
add    $0x1,%rdi
mov    %rdi,0x2edb(%rip)
cmpb   $0xd,0x2ec4(%rip)
je     119f <readResLine+0x8f>
xor    %ebp,%ebp
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <sscanf@plt>
movzbl 0x2eac(%rip),%ecx
mov    0x2ead(%rip),%rax
cmp    $0xd,%cl
je     1150 <readResLine+0x40>
lea    0x1(%rax),%rdx
mov    %rdx,0x2e9d(%rip)
mov    %ecx,%ebp
jmp    1150 <readResLine+0x40>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@readResLine.aChar = internal global i8 0
@readResLine.ptr = internal global i8* null
@readResLine.sptr = internal global i8* null
@readResLine.begin = internal global i16 1
@.str = [3 x i8] c"%c\00"
define i32 @readResLine(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i16, i16* @readResLine.begin
%6 = icmp ne i16 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i8*, i8** %3
store i8* %8, i8** @readResLine.sptr
store i16 0, i16* @readResLine.begin
br label %9
9: ; preds = %7, %2
%10 = load i8*, i8** %4
store i8* %10, i8** @readResLine.ptr
br label %11
11: ; preds = %26, %9
%12 = load i8*, i8** @readResLine.sptr
%13 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* @readResLine.aChar)
%14 = load i8, i8* @readResLine.aChar
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 13
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = load i8*, i8** @readResLine.ptr
store i8 0, i8* %18
br label %23
19: ; preds = %11
%20 = load i8, i8* @readResLine.aChar
%21 = load i8*, i8** @readResLine.ptr
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** @readResLine.ptr
store i8 %20, i8* %21
br label %23
23: ; preds = %19, %17
%24 = load i8*, i8** @readResLine.sptr
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** @readResLine.sptr
br label %26
26: ; preds = %23
%27 = load i8, i8* @readResLine.aChar
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 13
br i1 %29, label %11, label %30
30: ; preds = %26
ret i32 1
}

LLVM IR (-O2):
@readResLine.aChar = internal global i8 0
@readResLine.ptr = internal unnamed_addr global i8* null
@readResLine.sptr = internal unnamed_addr global i8* null
@readResLine.begin = internal unnamed_addr global i1 false
@.str = [3 x i8] c"%c\00"
define i32 @readResLine(i8* %0, i8* %1) {
%3 = load i1, i1* @readResLine.begin
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = load i8*, i8** @readResLine.sptr
br label %7
6: ; preds = %2
store i8* %0, i8** @readResLine.sptr
store i1 true, i1* @readResLine.begin
br label %7
7: ; preds = %4, %6
%8 = phi i8* [ %5, %4 ], [ %0, %6 ]
store i8* %1, i8** @readResLine.ptr
br label %9
9: ; preds = %17, %7
%10 = phi i8* [ %20, %17 ], [ %8, %7 ]
%11 = tail call i32 (i8*, i8*, ...) @sscanf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* @readResLine.aChar)
%12 = load i8, i8* @readResLine.aChar
%13 = icmp eq i8 %12, 13
%14 = load i8*, i8** @readResLine.ptr
br i1 %13, label %17, label %15
15: ; preds = %9
%16 = getelementptr inbounds i8, i8* %14, i64 1
store i8* %16, i8** @readResLine.ptr
br label %17
17: ; preds = %9, %15
%18 = phi i8 [ %12, %15 ], [ 0, %9 ]
store i8 %18, i8* %14
%19 = load i8*, i8** @readResLine.sptr
%20 = getelementptr inbounds i8, i8* %19, i64 1
store i8* %20, i8** @readResLine.sptr
%21 = load i8, i8* @readResLine.aChar
%22 = icmp eq i8 %21, 13
br i1 %22, label %23, label %9
23: ; preds = %17
ret i32 1
}