#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*/ value;
typedef int /*<<< orphan*/ key;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ splitConfigLine(char const *, int, char *, int, char *);
scalar_t__ strcmp(char const *, char *);
bool testSplitLine1(void) {
  char const *line = "var=10\n";
  char const *expectedKey = "var";
  char const *expectedValue = "10";
  char key[256];
  char value[256];
  if (!splitConfigLine(line, sizeof(key), key, sizeof(value), value)) {
    printf("splitConfigLine returned false\n");
    return false;
  }
  if (0 != strcmp(expectedKey, key)) {
    printf("Bad key. Expected: '%s' Actual: '%s'\n", expectedKey, key);
    return false;
  }
  if (0 != strcmp(expectedValue, value)) {
    printf("Bad value. Expected: '%s' Actual: '%s'\n", expectedValue, value);
    return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<testSplitLine1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
lea    0xebe(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xebb(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%r8
mov    $0x100,%ecx
mov    %ecx,%esi
call   1050 <splitConfigLine@plt>
cmp    $0x0,%eax
jne    119d <testSplitLine1+0x6d>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    122a <testSplitLine1+0xfa>
mov    -0x18(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11e0 <testSplitLine1+0xb0>
mov    -0x18(%rbp),%rsi
lea    -0x120(%rbp),%rdx
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    122a <testSplitLine1+0xfa>
mov    -0x20(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1223 <testSplitLine1+0xf3>
mov    -0x20(%rbp),%rsi
lea    -0x220(%rbp),%rdx
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    122a <testSplitLine1+0xfa>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testSplitLine1>:
push   %rbx
sub    $0x200,%rsp
lea    0xeb1(%rip),%rdi
lea    0x100(%rsp),%rdx
mov    %rsp,%r8
mov    $0x100,%esi
mov    $0x100,%ecx
call   1060 <splitConfigLine@plt>
test   %eax,%eax
je     11a0 <testSplitLine1+0x60>
lea    0xe94(%rip),%rdi
lea    0x100(%rsp),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11b0 <testSplitLine1+0x70>
lea    0xe82(%rip),%rdi
lea    0xe74(%rip),%rsi
xor    %ebx,%ebx
lea    0x100(%rsp),%rdx
jmp    11d7 <testSplitLine1+0x97>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
jmp    11de <testSplitLine1+0x9e>
lea    0xe55(%rip),%rdi
mov    %rsp,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11e9 <testSplitLine1+0xa9>
lea    0xe6a(%rip),%rdi
lea    0xe3a(%rip),%rsi
xor    %ebx,%ebx
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x200,%rsp
pop    %rbx
ret
mov    $0x1,%ebx
jmp    11de <testSplitLine1+0x9e>

LLVM IR (-O0):
@.str = [8 x i8] c"var=10\0A\00"
@.str.1 = [4 x i8] c"var\00"
@.str.2 = [3 x i8] c"10\00"
@.str.3 = [32 x i8] c"splitConfigLine returned false\0A\00"
@.str.4 = [38 x i8] c"Bad key. Expected: '%s' Actual: '%s'\0A\00"
@.str.5 = [40 x i8] c"Bad value. Expected: '%s' Actual: '%s'\0A\00"
define i32 @testSplitLine1() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %4
%7 = load i8*, i8** %2
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%10 = call i32 @splitConfigLine(i8* %7, i32 256, i8* %8, i32 256, i8* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %33
14: ; preds = %0
%15 = load i8*, i8** %3
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%17 = call i64 @strcmp(i8* %15, i8* %16)
%18 = icmp ne i64 0, %17
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %20, i8* %21)
store i32 0, i32* %1
br label %33
23: ; preds = %14
%24 = load i8*, i8** %4
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%26 = call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp ne i64 0, %26
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = load i8*, i8** %4
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i8* %29, i8* %30)
store i32 0, i32* %1
br label %33
32: ; preds = %23
store i32 1, i32* %1
br label %33
33: ; preds = %32, %28, %19, %12
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [8 x i8] c"var=10\0A\00"
@.str.1 = [4 x i8] c"var\00"
@.str.2 = [3 x i8] c"10\00"
@.str.4 = [38 x i8] c"Bad key. Expected: '%s' Actual: '%s'\0A\00"
@.str.5 = [40 x i8] c"Bad value. Expected: '%s' Actual: '%s'\0A\00"
@str = [31 x i8] c"splitConfigLine returned false\00"
define i32 @testSplitLine1() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = call i32 @splitConfigLine(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 256, i8* %3, i32 256, i8* %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %19
9: ; preds = %0
%10 = call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %19
14: ; preds = %9
%15 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
br label %19
19: ; preds = %14, %17, %12, %7
%20 = phi i32 [ 0, %12 ], [ 0, %17 ], [ 0, %7 ], [ 1, %14 ]
ret i32 %20
}