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

/* Variables and functions */
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int sscanf(char *, char *, int *, int *);
int de_ascii_read_first_line(FILE *f, int *record_size) {
  char buff[100 + 1];
  if (fgets(buff, sizeof(buff) - 1, f)) {
    int kz, nc;
    if (sscanf(buff, "KSIZE=  %d    NCOEFF=  %d\n", &kz, &nc) == 2) {
      *record_size = nc;
      return 0;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<de_ascii_read_first_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x64,%esi
call   1030 <fgets@plt>
cmp    $0x0,%rax
je     1193 <de_ascii_read_first_line+0x73>
lea    -0x80(%rbp),%rdi
lea    0xea6(%rip),%rsi
lea    -0x84(%rbp),%rdx
lea    -0x88(%rbp),%rcx
call   1040 <sscanf@plt>
cmp    $0x2,%eax
jne    118e <de_ascii_read_first_line+0x6e>
mov    -0x88(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    119a <de_ascii_read_first_line+0x7a>
jmp    1193 <de_ascii_read_first_line+0x73>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<de_ascii_read_first_line>:
push   %rbp
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbx
mov    %rdi,%rdx
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
call   1030 <fgets@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
je     116d <de_ascii_read_first_line+0x4d>
lea    0xeb4(%rip),%rsi
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1040 <sscanf@plt>
cmp    $0x2,%eax
jne    116d <de_ascii_read_first_line+0x4d>
mov    0x8(%rsp),%eax
mov    %eax,(%rbx)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x78,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"KSIZE= %d NCOEFF= %d\0A\00"
define i32 @de_ascii_read_first_line(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca [101 x i8]
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
%9 = getelementptr inbounds [101 x i8], [101 x i8]* %6, i64 0, i64 0
%10 = load i32*, i32** %4
%11 = call i64 @fgets(i8* %9, i32 100, i32* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = getelementptr inbounds [101 x i8], [101 x i8]* %6, i64 0, i64 0
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32* %7, i32* %8)
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32, i32* %8
%19 = load i32*, i32** %5
store i32 %18, i32* %19
store i32 0, i32* %3
br label %22
20: ; preds = %13
br label %21
21: ; preds = %20, %2
store i32 -1, i32* %3
br label %22
22: ; preds = %21, %17
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [27 x i8] c"KSIZE= %d NCOEFF= %d\0A\00"
define i32 @de_ascii_read_first_line(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = alloca [101 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%7 = call i64 @fgets(i8* %6, i32 100, i32* %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %2
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%13 = icmp eq i32 %12, 2
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = load i32, i32* %5
store i32 %15, i32* %1
br label %17
16: ; preds = %9
br label %17
17: ; preds = %2, %16, %14
%18 = phi i32 [ 0, %14 ], [ -1, %16 ], [ -1, %2 ]
ret i32 %18
}