#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncasecmp(char *, char *, int);
main(int argc, char **argv) {
  char reply[1024];
  int hasreply = 0;
  int i = 0;
  FILE *configflash;
  if (argc < 2) {
    fprintf(stderr, "Usage %s <property>\n", argv[0]);
    exit(0);
  }
  configflash = fopen("/rw/sage/Sage.properties", "rb");
  if (configflash) {
    char tmpline[1024];
    int palmode = 0;
    tmpline[1023] = 0;
    while (!feof(configflash)) {
      if (fgets(tmpline, 1023, configflash) == NULL)
        break;
      if (strncasecmp(tmpline, argv[1], strlen(argv[1])) == 0) {
        strcpy(reply, tmpline + strlen(argv[1]) + 1);
        hasreply = 1;
      }
      if (((unsigned char)tmpline[0]) == 0xFF)
        break;
    }
    fclose(configflash);
  }
  if (hasreply) {
    for (i = 0; i < strlen(reply); i++) {
      if (reply[i] == '\n')
        reply[i] = 0;
    }
    printf("%s", reply);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x850,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x414(%rbp)
movl   $0x0,-0x418(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11fa <main+0x5a>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe12(%rip),%rsi
call   1080 <fprintf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    0xe14(%rip),%rdi
lea    0xe26(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x420(%rbp)
cmpq   $0x0,-0x420(%rbp)
je     133b <main+0x19b>
movl   $0x0,-0x824(%rbp)
movb   $0x0,-0x421(%rbp)
mov    -0x420(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1254 <main+0xb4>
jmp    132f <main+0x18f>
lea    -0x820(%rbp),%rdi
mov    -0x420(%rbp),%rdx
mov    $0x3ff,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
jne    127b <main+0xdb>
jmp    132f <main+0x18f>
lea    -0x820(%rbp),%rax
mov    %rax,-0x838(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x830(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strlen@plt>
mov    -0x838(%rbp),%rdi
mov    -0x830(%rbp),%rsi
mov    %eax,%edx
call   10a0 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1313 <main+0x173>
lea    -0x410(%rbp),%rax
mov    %rax,-0x840(%rbp)
lea    -0x820(%rbp),%rax
mov    %rax,-0x848(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strlen@plt>
mov    -0x848(%rbp),%rsi
mov    -0x840(%rbp),%rdi
cltq
add    %rax,%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x414(%rbp)
movzbl -0x820(%rbp),%eax
cmp    $0xff,%eax
jne    132a <main+0x18a>
jmp    132f <main+0x18f>
jmp    1233 <main+0x93>
mov    -0x420(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x0,-0x414(%rbp)
je     13cd <main+0x22d>
movl   $0x0,-0x418(%rbp)
mov    -0x418(%rbp),%eax
mov    %eax,-0x84c(%rbp)
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x84c(%rbp),%eax
cmp    %ecx,%eax
jge    13ba <main+0x21a>
movslq -0x418(%rbp),%rax
movsbl -0x410(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    13a1 <main+0x201>
movslq -0x418(%rbp),%rax
movb   $0x0,-0x410(%rbp,%rax,1)
jmp    13a6 <main+0x206>
mov    -0x418(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x418(%rbp)
jmp    1352 <main+0x1b2>
lea    -0x410(%rbp),%rsi
lea    0xc69(%rip),%rdi
call   1060 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x808,%rsp
mov    %rsi,%r14
cmp    $0x1,%edi
jle    12d2 <main+0x132>
lea    0xe51(%rip),%rdi
lea    0xe63(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     12be <main+0x11e>
mov    %rax,%r13
movb   $0x0,0x7ff(%rsp)
xor    %ebp,%ebp
lea    0x400(%rsp),%r15
mov    %rsp,%r12
jmp    120a <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpb   $0xff,0x400(%rsp)
ff
je     126e <main+0xce>
mov    %r13,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    126e <main+0xce>
mov    %r15,%rdi
mov    $0x3ff,%esi
mov    %r13,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     126e <main+0xce>
mov    0x8(%r14),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   10a0 <strncasecmp@plt>
test   %rax,%rax
jne    1200 <main+0x60>
mov    0x8(%r14),%rdi
call   1050 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rsi
add    $0x401,%rsi
mov    %r12,%rdi
call   1030 <strcpy@plt>
mov    $0x1,%ebp
jmp    1200 <main+0x60>
mov    %r13,%rdi
call   1040 <fclose@plt>
test   %ebp,%ebp
je     12be <main+0x11e>
mov    %rsp,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    12af <main+0x10f>
xor    %ebp,%ebp
mov    %rsp,%rbx
jmp    12a3 <main+0x103>
nopl   (%rax)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    12af <main+0x10f>
cmpb   $0xa,(%rsp,%rbp,1)
jne    1290 <main+0xf0>
movb   $0x0,(%rsp,%rbp,1)
jmp    1290 <main+0xf0>
lea    0xd7b(%rip),%rdi
mov    %rsp,%rsi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xd1b(%rip),%rsi
call   1080 <fprintf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Usage %s <property>\0A\00"
@.str.1 = [25 x i8] c"/rw/sage/Sage.properties\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca [1024 x i8]
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %21
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %2
%22 = call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %22, i32** %9
%23 = load i32*, i32** %9
%24 = icmp ne i32* %23, null
br i1 %24, label %25, label %70
25: ; preds = %21
store i32 0, i32* %11
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 1023
store i8 0, i8* %26
br label %27
27: ; preds = %66, %25
%28 = load i32*, i32** %9
%29 = call i32 @feof(i32* %28)
%30 = icmp ne i32 %29, 0
%31 = xor i1 %30, true
br i1 %31, label %32, label %67
32: ; preds = %27
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%34 = load i32*, i32** %9
%35 = call i32* @fgets(i8* %33, i32 1023, i32* %34)
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %38
37: ; preds = %32
br label %67
38: ; preds = %32
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i32 @strlen(i8* %45)
%47 = call i64 @strncasecmp(i8* %39, i8* %42, i32 %46)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %60
49: ; preds = %38
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 1
%54 = load i8*, i8** %53
%55 = call i32 @strlen(i8* %54)
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8, i8* %51, i64 %56
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = call i32 @strcpy(i8* %50, i8* %58)
store i32 1, i32* %7
br label %60
60: ; preds = %49, %38
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%62 = load i8, i8* %61
%63 = zext i8 %62 to i32
%64 = icmp eq i32 %63, 255
br i1 %64, label %65, label %66
65: ; preds = %60
br label %67
66: ; preds = %60
br label %27
67: ; preds = %65, %37, %27
%68 = load i32*, i32** %9
%69 = call i32 @fclose(i32* %68)
br label %70
70: ; preds = %67, %21
%71 = load i32, i32* %7
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %97
73: ; preds = %70
store i32 0, i32* %8
br label %74
74: ; preds = %91, %73
%75 = load i32, i32* %8
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%77 = call i32 @strlen(i8* %76)
%78 = icmp slt i32 %75, %77
br i1 %78, label %79, label %94
79: ; preds = %74
%80 = load i32, i32* %8
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp eq i32 %84, 10
br i1 %85, label %86, label %90
86: ; preds = %79
%87 = load i32, i32* %8
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %88
store i8 0, i8* %89
br label %90
90: ; preds = %86, %79
br label %91
91: ; preds = %90
%92 = load i32, i32* %8
%93 = add nsw i32 %92, 1
store i32 %93, i32* %8
br label %74
94: ; preds = %74
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%96 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %95)
br label %97
97: ; preds = %94, %70
%98 = load i32, i32* %3
ret i32 %98
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Usage %s <property>\0A\00"
@.str.1 = [25 x i8] c"/rw/sage/Sage.properties\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = icmp slt i32 %0, 2
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %1
%10 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = tail call i32 @exit(i32 0)
unreachable
12: ; preds = %2
%13 = tail call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %62, label %15
15: ; preds = %12
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 1023
store i8 0, i8* %17
%18 = getelementptr inbounds i8*, i8** %1, i64 1
br label %19
19: ; preds = %38, %15
%20 = phi i32 [ 0, %15 ], [ %39, %38 ]
%21 = call i32 @feof(i32* %13)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %42
23: ; preds = %19
%24 = call i32* @fgets(i8* %16, i32 1023, i32* %13)
%25 = icmp eq i32* %24, null
br i1 %25, label %42, label %26
26: ; preds = %23
%27 = load i8*, i8** %18
%28 = call i32 @strlen(i8* %27)
%29 = call i64 @strncasecmp(i8* %16, i8* %27, i32 %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %26
%32 = load i8*, i8** %18
%33 = call i32 @strlen(i8* %32)
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %34
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = call i32 @strcpy(i8* %5, i8* %36)
br label %38
38: ; preds = %31, %26
%39 = phi i32 [ 1, %31 ], [ %20, %26 ]
%40 = load i8, i8* %16
%41 = icmp eq i8 %40, -1
br i1 %41, label %42, label %19
42: ; preds = %19, %23, %38
%43 = phi i32 [ %20, %23 ], [ %39, %38 ], [ %20, %19 ]
%44 = call i32 @fclose(i32* %13)
%45 = icmp eq i32 %43, 0
br i1 %45, label %62, label %46
46: ; preds = %42
%47 = call i32 @strlen(i8* %5)
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %60
49: ; preds = %46, %55
%50 = phi i64 [ %56, %55 ], [ 0, %46 ]
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = icmp eq i8 %52, 10
br i1 %53, label %54, label %55
54: ; preds = %49
store i8 0, i8* %51
br label %55
55: ; preds = %49, %54
%56 = add nuw nsw i64 %50, 1
%57 = call i32 @strlen(i8* %5)
%58 = sext i32 %57 to i64
%59 = icmp slt i64 %56, %58
br i1 %59, label %49, label %60
60: ; preds = %55, %46
%61 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %5)
br label %62
62: ; preds = %12, %60, %42
ret i32 0
}