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

/* Variables and functions */
int /*<<< orphan*/ ConvertLcase(char *, int);
int /*<<< orphan*/ memcmp(char *, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int xAP_GetLine(char *, char *, int);
int xAP_GetItem(char data[], char item[], char value[]) {
  int i = 0;
  char line[256];
  do {
    i = xAP_GetLine(data, line, i);
    ConvertLcase(line, (int)strlen(line));
    if (!memcmp(line, item, strlen(item))) {
      strcpy(value, line + strlen(item));
      return (i);
    }
  } while (i != -1);
  return (0);
}


x86 assembly (clang, -O0):
<xAP_GetItem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x130(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1050 <xAP_GetLine@plt>
mov    %eax,-0x24(%rbp)
lea    -0x130(%rbp),%rax
mov    %rax,-0x148(%rbp)
lea    -0x130(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x148(%rbp),%rdi
mov    %eax,%esi
call   1030 <ConvertLcase@plt>
lea    -0x130(%rbp),%rax
mov    %rax,-0x140(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x138(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x140(%rbp),%rdi
mov    -0x138(%rbp),%rsi
mov    %eax,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%eax
jne    1231 <xAP_GetItem+0xe1>
mov    -0x20(%rbp),%rax
mov    %rax,-0x150(%rbp)
lea    -0x130(%rbp),%rax
mov    %rax,-0x158(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x158(%rbp),%rsi
mov    -0x150(%rbp),%rdi
cltq
add    %rax,%rsi
call   1040 <strcpy@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1247 <xAP_GetItem+0xf7>
jmp    1236 <xAP_GetItem+0xe6>
cmpl   $0xffffffff,-0x24(%rbp)
jne    116e <xAP_GetItem+0x1e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xAP_GetItem>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
mov    %rsp,%r13
xchg   %ax,%ax
mov    %r12,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   1050 <xAP_GetLine@plt>
mov    %eax,%ebx
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    %eax,%esi
call   1030 <ConvertLcase@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1070 <memcmp@plt>
test   %eax,%eax
je     11b3 <xAP_GetItem+0x63>
cmp    $0xffffffff,%ebx
jne    1170 <xAP_GetItem+0x20>
xor    %ebx,%ebx
jmp    11c9 <xAP_GetItem+0x79>
mov    %r15,%rdi
call   1060 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rsi
mov    %r14,%rdi
call   1040 <strcpy@plt>
mov    %ebx,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @xAP_GetItem(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [256 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 0, i32* %8
br label %10
10: ; preds = %35, %3
%11 = load i8*, i8** %5
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%13 = load i32, i32* %8
%14 = call i32 @xAP_GetLine(i8* %11, i8* %12, i32 %13)
store i32 %14, i32* %8
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = call i32 @ConvertLcase(i8* %15, i32 %17)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%20 = load i8*, i8** %6
%21 = load i8*, i8** %6
%22 = call i32 @strlen(i8* %21)
%23 = call i32 @memcmp(i8* %19, i8* %20, i32 %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %34, label %25
25: ; preds = %10
%26 = load i8*, i8** %7
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%28 = load i8*, i8** %6
%29 = call i32 @strlen(i8* %28)
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %27, i64 %30
%32 = call i32 @strcpy(i8* %26, i8* %31)
%33 = load i32, i32* %8
store i32 %33, i32* %4
br label %39
34: ; preds = %10
br label %35
35: ; preds = %34
%36 = load i32, i32* %8
%37 = icmp ne i32 %36, -1
br i1 %37, label %10, label %38
38: ; preds = %35
store i32 0, i32* %4
br label %39
39: ; preds = %38, %25
%40 = load i32, i32* %4
ret i32 %40
}

LLVM IR (-O2):
define i32 @xAP_GetItem(i8* %0, i8* %1, i8* %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
br label %6
6: ; preds = %19, %3
%7 = phi i32 [ 0, %3 ], [ %8, %19 ]
%8 = call i32 @xAP_GetLine(i8* %0, i8* %5, i32 %7)
%9 = call i32 @strlen(i8* %5)
%10 = call i32 @ConvertLcase(i8* %5, i32 %9)
%11 = call i32 @strlen(i8* %1)
%12 = call i32 @memcmp(i8* %5, i8* %1, i32 %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %6
%15 = call i32 @strlen(i8* %1)
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %16
%18 = call i32 @strcpy(i8* %2, i8* %17)
br label %21
19: ; preds = %6
%20 = icmp eq i32 %8, -1
br i1 %20, label %21, label %6
21: ; preds = %19, %14
%22 = phi i32 [ %8, %14 ], [ 0, %19 ]
ret i32 %22
}