#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*/ fisError(char *);
int /*<<< orphan*/ *getNextLine(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, char *, double *);
double getNumber(char *buf, FILE *fp) {
  int tmp;
  char string[500];
  double num;
  if (getNextLine(buf, fp) == NULL)
    fisError("getNumber: Incomplete FIS file!");
  tmp = sscanf(buf, " %[^=] = %lf ", string, &num);
  if (tmp != 2) {
    printf("Error format in FIS file when parsing\n");
    printf("\"%s\"\n", buf);
    fisError("Error in getNumber().");
  }
  return (num);
}


x86 assembly (clang, -O0):
<getNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <getNextLine@plt>
cmp    $0x0,%rax
jne    1176 <getNumber+0x36>
lea    0xe8f(%rip),%rdi
call   1030 <fisError@plt>
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rdx
lea    0xe98(%rip),%rsi
lea    -0x218(%rbp),%rcx
call   1060 <sscanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
je     11cd <getNumber+0x8d>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
call   1030 <fisError@plt>
movsd  -0x218(%rbp),%xmm0
ff
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNumber>:
push   %rbx
sub    $0x210,%rsp
mov    %rdi,%rbx
call   1060 <getNextLine@plt>
test   %rax,%rax
jne    1171 <getNumber+0x21>
lea    0xe94(%rip),%rdi
call   1030 <fisError@plt>
lea    0xea8(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
call   1070 <sscanf@plt>
cmp    $0x2,%eax
je     11b8 <getNumber+0x68>
lea    0xeb4(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe81(%rip),%rdi
call   1030 <fisError@plt>
movsd  0x8(%rsp),%xmm0
add    $0x210,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"getNumber: Incomplete FIS file!\00"
@.str.1 = [14 x i8] c" %[^=] = %lf \00"
@.str.2 = [39 x i8] c"Error format in FIS file when parsing\0A\00"
@.str.3 = [6 x i8] c"\22%s\22\0A\00"
@.str.4 = [22 x i8] c"Error in getNumber().\00"
define double @getNumber(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [500 x i8]
%7 = alloca double
store i8* %0, i8** %3
store i32* %1, i32** %4
%8 = load i8*, i8** %3
%9 = load i32*, i32** %4
%10 = call i32* @getNextLine(i8* %8, i32* %9)
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @fisError(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
%15 = load i8*, i8** %3
%16 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%17 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %16, double* %7)
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = icmp ne i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%22 = load i8*, i8** %3
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %22)
%24 = call i32 @fisError(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %20, %14
%26 = load double, double* %7
ret double %26
}

LLVM IR (-O2):
@.str = [32 x i8] c"getNumber: Incomplete FIS file!\00"
@.str.1 = [14 x i8] c" %[^=] = %lf \00"
@.str.3 = [6 x i8] c"\22%s\22\0A\00"
@.str.4 = [22 x i8] c"Error in getNumber().\00"
@str = [38 x i8] c"Error format in FIS file when parsing\00"
define double @getNumber(i8* %0, i32* %1) {
%3 = alloca [500 x i8]
%4 = alloca double
%5 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%6 = bitcast double* %4 to i8*
%7 = tail call i32* @getNextLine(i8* %0, i32* %1)
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @fisError(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %5, double* %4)
%13 = icmp eq i32 %12, 2
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%17 = call i32 @fisError(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %18
18: ; preds = %14, %11
%19 = load double, double* %4
ret double %19
}