#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 EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ *strstr(char *, char *);
char *GetIniKeyString(char *title, char *key, char *filename) {
  FILE *fp;
  char szLine[1024];
  static char tmpstr[1024];
  int rtnval;
  int i = 0;
  int flag = 0;
  char *tmp;
  if ((fp = fopen(filename, "r")) == NULL) {
    printf("have   no   such   file \n");
    return NULL;
  }
  while (!feof(fp)) {
    rtnval = fgetc(fp);
    if (rtnval == EOF) {
      break;
    } else {
      szLine[i++] = rtnval;
    }
    if (rtnval == '\n') {
      i--;
      szLine[--i] = '\0';
      i = 0;
      tmp = strchr(szLine, '=');
      if ((tmp != NULL) && (flag == 1)) {
        if (strstr(szLine, key) != NULL) {
          if ('#' == szLine[0]) {
          } else if ('/' == szLine[0] && '/' == szLine[1]) {
          } else {
            strcpy(tmpstr, tmp + 1);
            fclose(fp);
            return tmpstr;
          }
        }
      } else {
        strcpy(tmpstr, "[");
        strcat(tmpstr, title);
        strcat(tmpstr, "]");
        if (strncmp(tmpstr, szLine, strlen(tmpstr)) == 0) {
          flag = 1;
        }
      }
    }
  }
  fclose(fp);
  return NULL;
}


x86 assembly (clang, -O0):
<GetIniKeyString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x438(%rbp)
movl   $0x0,-0x43c(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe1a(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1212 <GetIniKeyString+0x62>
lea    0xe02(%rip),%rdi
call   1080 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    142a <GetIniKeyString+0x27a>
jmp    1217 <GetIniKeyString+0x67>
mov    -0x28(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1235 <GetIniKeyString+0x85>
jmp    1419 <GetIniKeyString+0x269>
mov    -0x28(%rbp),%rdi
call   1090 <fgetc@plt>
mov    %eax,-0x434(%rbp)
mov    -0x434(%rbp),%eax
mov    0x2d97(%rip),%rcx
cmp    (%rcx),%eax
jne    125e <GetIniKeyString+0xae>
jmp    1419 <GetIniKeyString+0x269>
mov    -0x434(%rbp),%eax
mov    %al,%cl
mov    -0x438(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x438(%rbp)
cltq
mov    %cl,-0x430(%rbp,%rax,1)
cmpl   $0xa,-0x434(%rbp)
jne    1414 <GetIniKeyString+0x264>
mov    -0x438(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x438(%rbp)
mov    -0x438(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x438(%rbp)
cltq
movb   $0x0,-0x430(%rbp,%rax,1)
movl   $0x0,-0x438(%rbp)
lea    -0x430(%rbp),%rdi
mov    $0x3d,%esi
call   1070 <strchr@plt>
mov    %rax,-0x448(%rbp)
cmpq   $0x0,-0x448(%rbp)
je     1391 <GetIniKeyString+0x1e1>
cmpl   $0x1,-0x43c(%rbp)
jne    1391 <GetIniKeyString+0x1e1>
lea    -0x430(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     138c <GetIniKeyString+0x1dc>
movsbl -0x430(%rbp),%ecx
mov    $0x23,%eax
cmp    %ecx,%eax
jne    1325 <GetIniKeyString+0x175>
jmp    1387 <GetIniKeyString+0x1d7>
movsbl -0x430(%rbp),%ecx
mov    $0x2f,%eax
cmp    %ecx,%eax
jne    1352 <GetIniKeyString+0x1a2>
movsbl -0x42f(%rbp),%ecx
mov    $0x2f,%eax
cmp    %ecx,%eax
jne    1352 <GetIniKeyString+0x1a2>
jmp    1382 <GetIniKeyString+0x1d2>
mov    -0x448(%rbp),%rsi
add    $0x1,%rsi
lea    0x2d2c(%rip),%rdi
call   1040 <strcpy@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
lea    0x2d17(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    142a <GetIniKeyString+0x27a>
jmp    1387 <GetIniKeyString+0x1d7>
jmp    138c <GetIniKeyString+0x1dc>
jmp    140f <GetIniKeyString+0x25f>
lea    0x2cf8(%rip),%rdi
lea    0xc7d(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rsi
lea    0x2ce1(%rip),%rdi
call   10c0 <strcat@plt>
lea    0x2cd5(%rip),%rdi
lea    0xc5c(%rip),%rsi
call   10c0 <strcat@plt>
lea    -0x430(%rbp),%rax
mov    %rax,-0x450(%rbp)
lea    0x2cb4(%rip),%rdi
call   1060 <strlen@plt>
mov    -0x450(%rbp),%rsi
mov    %eax,%edx
lea    0x2c9f(%rip),%rdi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    140a <GetIniKeyString+0x25a>
movl   $0x1,-0x43c(%rbp)
jmp    140f <GetIniKeyString+0x25f>
jmp    1414 <GetIniKeyString+0x264>
jmp    1217 <GetIniKeyString+0x67>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetIniKeyString>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdi,(%rsp)
lea    0xe2f(%rip),%rsi
mov    %rdx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     11f7 <GetIniKeyString+0x47>
mov    %rax,%rbx
mov    %rax,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
je     121b <GetIniKeyString+0x6b>
mov    %rbx,%rdi
call   1060 <fclose@plt>
jmp    1203 <GetIniKeyString+0x53>
lea    0xe08(%rip),%rdi
call   1050 <puts@plt>
xor    %r12d,%r12d
mov    %r12,%rax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r15d,%r15d
lea    0x10(%rsp),%r13
lea    0x2e66(%rip),%r12
xor    %r14d,%r14d
jmp    1240 <GetIniKeyString+0x90>
nop
add    $0x1,%r14d
mov    %rbx,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
jne    11ed <GetIniKeyString+0x3d>
mov    %rbx,%rdi
call   1090 <fgetc@plt>
mov    0x2d99(%rip),%rcx
cmp    (%rcx),%eax
je     11ed <GetIniKeyString+0x3d>
movslq %r14d,%rcx
mov    %al,0x10(%rsp,%rcx,1)
cmp    $0xa,%eax
jne    1230 <GetIniKeyString+0x80>
movb   $0x0,-0x1(%rcx,%r13,1)
mov    %r13,%rdi
mov    $0x3d,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     12c0 <GetIniKeyString+0x110>
cmp    $0x1,%r15d
jne    12c0 <GetIniKeyString+0x110>
mov    %rax,%rbp
mov    %r13,%rdi
mov    0x8(%rsp),%rsi
call   10d0 <strstr@plt>
xor    %r14d,%r14d
mov    $0x1,%r15d
test   %rax,%rax
je     1234 <GetIniKeyString+0x84>
movzbl 0x10(%rsp),%eax
cmp    $0x23,%al
je     1234 <GetIniKeyString+0x84>
cmp    $0x2f,%al
jne    1313 <GetIniKeyString+0x163>
cmpb   $0x2f,0x11(%rsp)
je     1234 <GetIniKeyString+0x84>
jmp    1313 <GetIniKeyString+0x163>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
lea    0xd38(%rip),%rsi
call   1040 <strcpy@plt>
mov    %r12,%rdi
mov    (%rsp),%rsi
call   10c0 <strcat@plt>
mov    %r12,%rdi
lea    0xd1f(%rip),%rsi
call   10c0 <strcat@plt>
mov    %r12,%rdi
call   1070 <strlen@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
mov    $0x1,%eax
cmove  %eax,%r15d
xor    %r14d,%r14d
jmp    1234 <GetIniKeyString+0x84>
add    $0x1,%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
jmp    1206 <GetIniKeyString+0x56>

LLVM IR (-O0):
@GetIniKeyString.tmpstr = internal global [1024 x i8] zeroinitializer
@.str = [2 x i8] c"r\00"
@.str.1 = [26 x i8] c"have no such file \0A\00"
@EOF = global i32 0
@.str.2 = [2 x i8] c"[\00"
@.str.3 = [2 x i8] c"]\00"
define i8* @GetIniKeyString(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca [1024 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 0, i32* %11
store i32 0, i32* %12
%14 = load i8*, i8** %7
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %8
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i8* null, i8** %4
br label %103
19: ; preds = %3
br label %20
20: ; preds = %99, %19
%21 = load i32*, i32** %8
%22 = call i32 @feof(i32* %21)
%23 = icmp ne i32 %22, 0
%24 = xor i1 %23, true
br i1 %24, label %25, label %100
25: ; preds = %20
%26 = load i32*, i32** %8
%27 = call i32 @fgetc(i32* %26)
store i32 %27, i32* %10
%28 = load i32, i32* %10
%29 = load i32, i32* @EOF
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %25
br label %100
32: ; preds = %25
%33 = load i32, i32* %10
%34 = trunc i32 %33 to i8
%35 = load i32, i32* %11
%36 = add nsw i32 %35, 1
store i32 %36, i32* %11
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %37
store i8 %34, i8* %38
br label %39
39: ; preds = %32
%40 = load i32, i32* %10
%41 = icmp eq i32 %40, 10
br i1 %41, label %42, label %99
42: ; preds = %39
%43 = load i32, i32* %11
%44 = add nsw i32 %43, -1
store i32 %44, i32* %11
%45 = load i32, i32* %11
%46 = add nsw i32 %45, -1
store i32 %46, i32* %11
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 %47
store i8 0, i8* %48
store i32 0, i32* %11
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%50 = call i8* @strchr(i8* %49, i8 signext 61)
store i8* %50, i8** %13
%51 = load i8*, i8** %13
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %87
53: ; preds = %42
%54 = load i32, i32* %12
%55 = icmp eq i32 %54, 1
br i1 %55, label %56, label %87
56: ; preds = %53
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%58 = load i8*, i8** %6
%59 = call i32* @strstr(i8* %57, i8* %58)
%60 = icmp ne i32* %59, null
br i1 %60, label %61, label %86
61: ; preds = %56
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 35, %64
br i1 %65, label %66, label %67
66: ; preds = %61
br label %85
67: ; preds = %61
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 47, %70
br i1 %71, label %72, label %78
72: ; preds = %67
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 1
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 47, %75
br i1 %76, label %77, label %78
77: ; preds = %72
br label %84
78: ; preds = %72, %67
%79 = load i8*, i8** %13
%80 = getelementptr inbounds i8, i8* %79, i64 1
%81 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8* %80)
%82 = load i32*, i32** %8
%83 = call i32 @fclose(i32* %82)
store i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8** %4
br label %103
84: ; preds = %77
br label %85
85: ; preds = %84, %66
br label %86
86: ; preds = %85, %56
br label %98
87: ; preds = %53, %42
%88 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%89 = load i8*, i8** %5
%90 = call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8* %89)
%91 = call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%92 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%93 = call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0))
%94 = call i64 @strncmp(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8* %92, i32 %93)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %87
store i32 1, i32* %12
br label %97
97: ; preds = %96, %87
br label %98
98: ; preds = %97, %86
br label %99
99: ; preds = %98, %39
br label %20
100: ; preds = %31, %20
%101 = load i32*, i32** %8
%102 = call i32 @fclose(i32* %101)
store i8* null, i8** %4
br label %103
103: ; preds = %100, %78, %17
%104 = load i8*, i8** %4
ret i8* %104
}

LLVM IR (-O2):
@GetIniKeyString.tmpstr = internal global [1024 x i8] zeroinitializer
@.str = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [2 x i8] c"[\00"
@.str.3 = [2 x i8] c"]\00"
@str = [25 x i8] c"have no such file \00"
define i8* @GetIniKeyString(i8* %0, i8* nocapture %1, i8* nocapture %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = tail call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = call i32 @feof(i32* %6)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %63
11: ; preds = %8
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 1
br label %15
13: ; preds = %3
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %65
15: ; preds = %11, %58
%16 = phi i32 [ 0, %11 ], [ %60, %58 ]
%17 = phi i32 [ 0, %11 ], [ %59, %58 ]
%18 = call i32 @fgetc(i32* %6)
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %63, label %21
21: ; preds = %15
%22 = trunc i32 %18 to i8
%23 = add nsw i32 %17, 1
%24 = sext i32 %17 to i64
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %24
store i8 %22, i8* %25
%26 = icmp eq i32 %18, 10
br i1 %26, label %27, label %58
27: ; preds = %21
%28 = add nsw i32 %17, -1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %29
store i8 0, i8* %30
%31 = call i8* @strchr(i8* %5, i8 signext 61)
%32 = icmp ne i8* %31, null
%33 = icmp eq i32 %16, 1
%34 = select i1 %32, i1 %33, i1 false
br i1 %34, label %35, label %50
35: ; preds = %27
%36 = call i32* @strstr(i8* %5, i8* dereferenceable(1) %1)
%37 = icmp eq i32* %36, null
%38 = load i8, i8* %5
%39 = icmp eq i8 %38, 35
%40 = select i1 %37, i1 true, i1 %39
br i1 %40, label %58, label %41
41: ; preds = %35
%42 = icmp eq i8 %38, 47
%43 = load i8, i8* %12
%44 = icmp eq i8 %43, 47
%45 = select i1 %42, i1 %44, i1 false
br i1 %45, label %58, label %46
46: ; preds = %41
%47 = getelementptr inbounds i8, i8* %31, i64 1
%48 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8* %47)
%49 = call i32 @fclose(i32* %6)
br label %65
50: ; preds = %27
%51 = call i32 @strcpy(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%52 = call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8* %0)
%53 = call i32 @strcat(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%54 = call i32 @strlen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0))
%55 = call i64 @strncmp(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), i8* %5, i32 %54)
%56 = icmp eq i64 %55, 0
%57 = select i1 %56, i32 1, i32 %16
br label %58
58: ; preds = %50, %41, %35, %21
%59 = phi i32 [ 0, %35 ], [ 0, %41 ], [ %23, %21 ], [ 0, %50 ]
%60 = phi i32 [ 1, %35 ], [ 1, %41 ], [ %16, %21 ], [ %57, %50 ]
%61 = call i32 @feof(i32* %6)
%62 = icmp eq i32 %61, 0
br i1 %62, label %15, label %63
63: ; preds = %58, %15, %8
%64 = call i32 @fclose(i32* %6)
br label %65
65: ; preds = %63, %46, %13
%66 = phi i8* [ null, %13 ], [ null, %63 ], [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @GetIniKeyString.tmpstr, i64 0, i64 0), %46 ]
ret i8* %66
}