#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 */
float atof(char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, scalar_t__);
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char *, char const *, int /*<<< orphan*/);
float seti_get_data(FILE *fp, const char *name) {
  char token[1000];
  char buffer[1000];
  float data;
  while (fgets(token, 1000, fp) != NULL)
    if (strncmp(token, name, strlen(name)) == 0) {
      strcpy(buffer, strchr(token, '=') + 1);
      break;
    }
  data = atof(buffer);
  return data;
}


x86 assembly (clang, -O0):
<seti_get_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x3e8,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     120f <seti_get_data+0xaf>
lea    -0x400(%rbp),%rax
mov    %rax,-0x808(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x800(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x808(%rbp),%rdi
mov    -0x800(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    120a <seti_get_data+0xaa>
lea    -0x7f0(%rbp),%rax
mov    %rax,-0x810(%rbp)
lea    -0x400(%rbp),%rdi
mov    $0x3d,%esi
call   1070 <strchr@plt>
mov    -0x810(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
call   1040 <strcpy@plt>
jmp    120f <seti_get_data+0xaf>
jmp    1173 <seti_get_data+0x13>
lea    -0x7f0(%rbp),%rdi
call   1050 <atof@plt>
movss  %xmm0,-0x7f4(%rbp)
ff
movss  -0x7f4(%rbp),%xmm0
ff
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seti_get_data>:
push   %r15
push   %r14
push   %rbx
sub    $0x7e0,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x3f0(%rsp),%r15
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x3e8,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     11cd <seti_get_data+0x6d>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1180 <seti_get_data+0x20>
lea    0x3f0(%rsp),%rdi
mov    $0x3d,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rsi
mov    %rsp,%rdi
call   1040 <strcpy@plt>
mov    %rsp,%rdi
call   1050 <atof@plt>
add    $0x7e0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define float @seti_get_data(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [1000 x i8]
%6 = alloca [1000 x i8]
%7 = alloca float
store i32* %0, i32** %3
store i8* %1, i8** %4
br label %8
8: ; preds = %26, %2
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%10 = load i32*, i32** %3
%11 = call i32* @fgets(i8* %9, i32 1000, i32* %10)
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %27
13: ; preds = %8
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%15 = load i8*, i8** %4
%16 = load i8*, i8** %4
%17 = call i32 @strlen(i8* %16)
%18 = call i64 @strncmp(i8* %14, i8* %15, i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %13
%21 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%23 = call i64 @strchr(i8* %22, i8 signext 61)
%24 = add nsw i64 %23, 1
%25 = call i32 @strcpy(i8* %21, i64 %24)
br label %27
26: ; preds = %13
br label %8
27: ; preds = %20, %8
%28 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%29 = call float @atof(i8* %28)
store float %29, float* %7
%30 = load float, float* %7
ret float %30
}

LLVM IR (-O2):
define float @seti_get_data(i32* nocapture %0, i8* %1) {
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
br label %7
7: ; preds = %10, %2
%8 = call i32* @fgets(i8* %5, i32 1000, i32* %0)
%9 = icmp eq i32* %8, null
br i1 %9, label %18, label %10
10: ; preds = %7
%11 = call i32 @strlen(i8* %1)
%12 = call i64 @strncmp(i8* %5, i8* %1, i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %10
%15 = call i64 @strchr(i8* %5, i8 signext 61)
%16 = add nsw i64 %15, 1
%17 = call i32 @strcpy(i8* %6, i64 %16)
br label %18
18: ; preds = %7, %14
%19 = call float @atof(i8* %6)
ret float %19
}