#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*/ cutspaces(char *);
char *strchr(char *, char);
int /*<<< orphan*/ strncpy(char *, char *, int);
int splitline(char *source, char *name, int size_name, char *value,
              int size_value) {
  char *equalchar;
  int n;
  equalchar = strchr(source, '=');
  value[0] = 0;
  name[0] = 0;
  if (equalchar) {
    strncpy(value, equalchar + 1, size_value);
    value[size_value - 1] = 0;
    cutspaces(value);
    n = equalchar - source;
    if (n > 0) {
      if (n > size_name - 1)
        n = size_name - 1;
      strncpy(name, source, n);
      name[n] = 0;
      cutspaces(name);
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<splitline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
cmpq   $0x0,-0x38(%rbp)
je     120c <splitline+0xdc>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%rsi
add    $0x1,%rsi
mov    -0x2c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x28(%rbp),%rdi
call   1050 <cutspaces@plt>
mov    -0x38(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jle    1207 <splitline+0xd7>
mov    -0x3c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    11d6 <splitline+0xa6>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x3c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1050 <cutspaces@plt>
movl   $0x1,-0x4(%rbp)
jmp    1213 <splitline+0xe3>
jmp    120c <splitline+0xdc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<splitline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r15d
mov    %rcx,%rbp
mov    %rdx,(%rsp)
mov    %rsi,%r14
mov    %rdi,%r12
mov    $0x3d,%esi
call   1040 <strchr@plt>
movb   $0x0,0x0(%rbp)
movb   $0x0,(%r14)
xor    %r13d,%r13d
test   %rax,%rax
je     11c0 <splitline+0x90>
mov    %rax,%rbx
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rbp,%rdi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movslq %r15d,%rax
movb   $0x0,-0x1(%rax,%rbp,1)
mov    %rbp,%rdi
call   1050 <cutspaces@plt>
sub    %r12d,%ebx
test   %ebx,%ebx
jle    11c0 <splitline+0x90>
mov    (%rsp),%rax
lea    -0x1(%rax),%ebp
cmp    %eax,%ebx
cmovl  %ebx,%ebp
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1030 <strncpy@plt>
movslq %ebp,%rax
movb   $0x0,(%r14,%rax,1)
mov    %r14,%rdi
call   1050 <cutspaces@plt>
mov    $0x1,%r13d
mov    %r13d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @splitline(i8* %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i32 %4, i32* %11
%14 = load i8*, i8** %7
%15 = call i8* @strchr(i8* %14, i8 signext 61)
store i8* %15, i8** %12
%16 = load i8*, i8** %10
%17 = getelementptr inbounds i8, i8* %16, i64 0
store i8 0, i8* %17
%18 = load i8*, i8** %8
%19 = getelementptr inbounds i8, i8* %18, i64 0
store i8 0, i8* %19
%20 = load i8*, i8** %12
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %63
22: ; preds = %5
%23 = load i8*, i8** %10
%24 = load i8*, i8** %12
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i32, i32* %11
%27 = call i32 @strncpy(i8* %23, i8* %25, i32 %26)
%28 = load i8*, i8** %10
%29 = load i32, i32* %11
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
store i8 0, i8* %32
%33 = load i8*, i8** %10
%34 = call i32 @cutspaces(i8* %33)
%35 = load i8*, i8** %12
%36 = load i8*, i8** %7
%37 = ptrtoint i8* %35 to i64
%38 = ptrtoint i8* %36 to i64
%39 = sub i64 %37, %38
%40 = trunc i64 %39 to i32
store i32 %40, i32* %13
%41 = load i32, i32* %13
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %62
43: ; preds = %22
%44 = load i32, i32* %13
%45 = load i32, i32* %9
%46 = sub nsw i32 %45, 1
%47 = icmp sgt i32 %44, %46
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = load i32, i32* %9
%50 = sub nsw i32 %49, 1
store i32 %50, i32* %13
br label %51
51: ; preds = %48, %43
%52 = load i8*, i8** %8
%53 = load i8*, i8** %7
%54 = load i32, i32* %13
%55 = call i32 @strncpy(i8* %52, i8* %53, i32 %54)
%56 = load i8*, i8** %8
%57 = load i32, i32* %13
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %56, i64 %58
store i8 0, i8* %59
%60 = load i8*, i8** %8
%61 = call i32 @cutspaces(i8* %60)
store i32 1, i32* %6
br label %64
62: ; preds = %22
br label %63
63: ; preds = %62, %5
store i32 0, i32* %6
br label %64
64: ; preds = %63, %51
%65 = load i32, i32* %6
ret i32 %65
}

LLVM IR (-O2):
define i32 @splitline(i8* %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 61)
store i8 0, i8* %3
store i8 0, i8* %1
%7 = icmp eq i8* %6, null
br i1 %7, label %28, label %8
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = tail call i32 @strncpy(i8* %3, i8* %9, i32 %4)
%11 = add nsw i32 %4, -1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %3, i64 %12
store i8 0, i8* %13
%14 = tail call i32 @cutspaces(i8* %3)
%15 = ptrtoint i8* %6 to i64
%16 = ptrtoint i8* %0 to i64
%17 = sub i64 %15, %16
%18 = trunc i64 %17 to i32
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %28
20: ; preds = %8
%21 = icmp slt i32 %18, %2
%22 = add nsw i32 %2, -1
%23 = select i1 %21, i32 %18, i32 %22
%24 = tail call i32 @strncpy(i8* %1, i8* %0, i32 %23)
%25 = sext i32 %23 to i64
%26 = getelementptr inbounds i8, i8* %1, i64 %25
store i8 0, i8* %26
%27 = tail call i32 @cutspaces(i8* %1)
br label %28
28: ; preds = %5, %8, %20
%29 = phi i32 [ 1, %20 ], [ 0, %8 ], [ 0, %5 ]
ret i32 %29
}