#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*/ store;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
scalar_t__ atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ gcvt(float, int, char *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, char *, int);
char *strstr(char *, char *);
void getInfor(char *path, char *name, char infor[]) {
  int fd = open(path, O_RDONLY);
  char store[2000];
  int k = 0;
  char *p = NULL;
  read(fd, store, sizeof(store));
  close(fd);
  p = strstr(store, name);
  while ((*p < '0') || (*p > '9')) {
    p++;
  }
  while ((*p >= '0') && (*p <= '9')) {
    infor[k] = *p;
    k++;
    p++;
  }
  infor[k] = '\0';
  float fInfor = (float)atoi(infor);
  fInfor = fInfor / 1024;
  gcvt(fInfor, 5, infor);
}


x86 assembly (clang, -O0):
<getInfor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x7f4(%rbp)
movq   $0x0,-0x800(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x7f0(%rbp),%rsi
mov    $0x7d0,%edx
call   1040 <read@plt>
mov    -0x1c(%rbp),%edi
call   1030 <close@plt>
lea    -0x7f0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strstr@plt>
mov    %rax,-0x800(%rbp)
mov    -0x800(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x30,%ecx
mov    %al,-0x805(%rbp)
jl     1205 <getInfor+0xa5>
mov    -0x800(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
setg   %al
mov    %al,-0x805(%rbp)
mov    -0x805(%rbp),%al
test   $0x1,%al
jne    1218 <getInfor+0xb8>
jmp    122f <getInfor+0xcf>
mov    -0x800(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x800(%rbp)
jmp    11d4 <getInfor+0x74>
jmp    1234 <getInfor+0xd4>
mov    -0x800(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x806(%rbp)
jl     1265 <getInfor+0x105>
mov    -0x800(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x806(%rbp)
mov    -0x806(%rbp),%al
test   $0x1,%al
jne    1278 <getInfor+0x118>
jmp    12b5 <getInfor+0x155>
mov    -0x800(%rbp),%rax
mov    (%rax),%dl
mov    -0x18(%rbp),%rax
movslq -0x7f4(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x7f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f4(%rbp)
mov    -0x800(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x800(%rbp)
jmp    1234 <getInfor+0xd4>
mov    -0x18(%rbp),%rax
movslq -0x7f4(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1070 <atoi@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x804(%rbp)
ff
movss  -0x804(%rbp),%xmm0
ff
movss  0xd16(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x804(%rbp)
ff
movss  -0x804(%rbp),%xmm0
ff
mov    -0x18(%rbp),%rsi
mov    $0x5,%edi
call   1050 <gcvt@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInfor>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x7d8,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
call   1060 <open@plt>
mov    %eax,%ebp
mov    %rsp,%r15
mov    %eax,%edi
mov    %r15,%rsi
mov    $0x7d0,%edx
call   1040 <read@plt>
mov    %ebp,%edi
call   1030 <close@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <strstr@plt>
nopw   0x0(%rax,%rax,1)
movzbl (%rax),%ecx
lea    -0x3a(%rcx),%edx
add    $0x1,%rax
cmp    $0xf6,%dl
jb     11b0 <getInfor+0x50>
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rbx,%rdx,1)
movzbl (%rax,%rdx,1),%ecx
add    $0x1,%rdx
lea    -0x30(%rcx),%esi
cmp    $0xa,%sil
jb     11d0 <getInfor+0x70>
mov    %edx,%eax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rdi
call   1070 <atoi@plt>
cvtsi2ss %rax,%xmm0
mulss  0xe01(%rip),%xmm0
mov    $0x5,%edi
mov    %rbx,%rsi
add    $0x7d8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <gcvt@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
define void @getInfor(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [2000 x i8]
%9 = alloca i32
%10 = alloca i8*
%11 = alloca float
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%12 = load i8*, i8** %4
%13 = load i32, i32* @O_RDONLY
%14 = call i32 @open(i8* %12, i32 %13)
store i32 %14, i32* %7
store i32 0, i32* %9
store i8* null, i8** %10
%15 = load i32, i32* %7
%16 = getelementptr inbounds [2000 x i8], [2000 x i8]* %8, i64 0, i64 0
%17 = call i32 @read(i32 %15, i8* %16, i32 2000)
%18 = load i32, i32* %7
%19 = call i32 @close(i32 %18)
%20 = getelementptr inbounds [2000 x i8], [2000 x i8]* %8, i64 0, i64 0
%21 = load i8*, i8** %5
%22 = call i8* @strstr(i8* %20, i8* %21)
store i8* %22, i8** %10
br label %23
23: ; preds = %35, %3
%24 = load i8*, i8** %10
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp slt i32 %26, 48
br i1 %27, label %33, label %28
28: ; preds = %23
%29 = load i8*, i8** %10
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp sgt i32 %31, 57
br label %33
33: ; preds = %28, %23
%34 = phi i1 [ true, %23 ], [ %32, %28 ]
br i1 %34, label %35, label %38
35: ; preds = %33
%36 = load i8*, i8** %10
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %10
br label %23
38: ; preds = %33
br label %39
39: ; preds = %51, %38
%40 = load i8*, i8** %10
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp sge i32 %42, 48
br i1 %43, label %44, label %49
44: ; preds = %39
%45 = load i8*, i8** %10
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp sle i32 %47, 57
br label %49
49: ; preds = %44, %39
%50 = phi i1 [ false, %39 ], [ %48, %44 ]
br i1 %50, label %51, label %62
51: ; preds = %49
%52 = load i8*, i8** %10
%53 = load i8, i8* %52
%54 = load i8*, i8** %6
%55 = load i32, i32* %9
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8, i8* %54, i64 %56
store i8 %53, i8* %57
%58 = load i32, i32* %9
%59 = add nsw i32 %58, 1
store i32 %59, i32* %9
%60 = load i8*, i8** %10
%61 = getelementptr inbounds i8, i8* %60, i32 1
store i8* %61, i8** %10
br label %39
62: ; preds = %49
%63 = load i8*, i8** %6
%64 = load i32, i32* %9
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
store i8 0, i8* %66
%67 = load i8*, i8** %6
%68 = call i64 @atoi(i8* %67)
%69 = sitofp i64 %68 to float
store float %69, float* %11
%70 = load float, float* %11
%71 = fdiv float %70, 1.024000e+03
store float %71, float* %11
%72 = load float, float* %11
%73 = load i8*, i8** %6
%74 = call i32 @gcvt(float %72, i32 5, i8* %73)
ret void
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define void @getInfor(i8* nocapture %0, i8* nocapture %1, i8* %2) {
%4 = alloca [2000 x i8]
%5 = load i32, i32* @O_RDONLY
%6 = tail call i32 @open(i8* %0, i32 %5)
%7 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 0
%8 = call i32 @read(i32 %6, i8* %7, i32 2000)
%9 = tail call i32 @close(i32 %6)
%10 = call i8* @strstr(i8* %7, i8* dereferenceable(1) %1)
br label %11
11: ; preds = %11, %3
%12 = phi i8* [ %10, %3 ], [ %16, %11 ]
%13 = load i8, i8* %12
%14 = add i8 %13, -58
%15 = icmp ult i8 %14, -10
%16 = getelementptr inbounds i8, i8* %12, i64 1
br i1 %15, label %11, label %17
17: ; preds = %11, %17
%18 = phi i64 [ %22, %17 ], [ 0, %11 ]
%19 = phi i8 [ %24, %17 ], [ %13, %11 ]
%20 = phi i8* [ %23, %17 ], [ %12, %11 ]
%21 = getelementptr inbounds i8, i8* %2, i64 %18
store i8 %19, i8* %21
%22 = add nuw i64 %18, 1
%23 = getelementptr inbounds i8, i8* %20, i64 1
%24 = load i8, i8* %23
%25 = add i8 %24, -48
%26 = icmp ult i8 %25, 10
br i1 %26, label %17, label %27
27: ; preds = %17
%28 = and i64 %22, 4294967295
%29 = getelementptr inbounds i8, i8* %2, i64 %28
store i8 0, i8* %29
%30 = tail call i64 @atoi(i8* %2)
%31 = sitofp i64 %30 to float
%32 = fmul float %31, 0x3F50000000000000
%33 = tail call i32 @gcvt(float %32, i32 5, i8* %2)
ret void
}