#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 strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strtok(char *, char *);
void getUserInfo(char *input, char *name, char *pass, int n) {
  char *token;
  int last;
  token = strtok(input, "=");
  token = strtok(NULL, "\n");
  strncpy(name, token, n);
  last = strlen(name) - 1;
  if (name[last] == '\r') {
    name[last] = '\0';
  }
  token = strtok(NULL, "=");
  token = strtok(NULL, "\n");
  strncpy(pass, token, n);
  last = strlen(pass) - 1;
  if (pass[last] == '\r') {
    pass[last] = '\0';
  }
}


x86 assembly (clang, -O0):
<getUserInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe9c(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
jne    11af <getUserInfo+0x7f>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe46(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe34(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
jne    1217 <getUserInfo+0xe7>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getUserInfo>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%rbp
lea    0xebc(%rip),%rsi
call   1050 <strtok@plt>
lea    0xeb2(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
mov    %r14d,%edx
call   1030 <strncpy@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xd,-0x1(%rax,%rbp,1)
jne    117b <getUserInfo+0x4b>
movb   $0x0,-0x1(%rbp,%rax,1)
lea    0xe7e(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
lea    0xe72(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r14d,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xd,-0x1(%rax,%rbx,1)
jne    11bb <getUserInfo+0x8b>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"=\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @getUserInfo(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%11 = load i8*, i8** %5
%12 = call i8* @strtok(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %9
%13 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %13, i8** %9
%14 = load i8*, i8** %6
%15 = load i8*, i8** %9
%16 = load i32, i32* %8
%17 = call i32 @strncpy(i8* %14, i8* %15, i32 %16)
%18 = load i8*, i8** %6
%19 = call i32 @strlen(i8* %18)
%20 = sub nsw i32 %19, 1
store i32 %20, i32* %10
%21 = load i8*, i8** %6
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 13
br i1 %27, label %28, label %33
28: ; preds = %4
%29 = load i8*, i8** %6
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 0, i8* %32
br label %33
33: ; preds = %28, %4
%34 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %34, i8** %9
%35 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %35, i8** %9
%36 = load i8*, i8** %7
%37 = load i8*, i8** %9
%38 = load i32, i32* %8
%39 = call i32 @strncpy(i8* %36, i8* %37, i32 %38)
%40 = load i8*, i8** %7
%41 = call i32 @strlen(i8* %40)
%42 = sub nsw i32 %41, 1
store i32 %42, i32* %10
%43 = load i8*, i8** %7
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 13
br i1 %49, label %50, label %55
50: ; preds = %33
%51 = load i8*, i8** %7
%52 = load i32, i32* %10
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
store i8 0, i8* %54
br label %55
55: ; preds = %50, %33
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"=\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @getUserInfo(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @strncpy(i8* %1, i8* %6, i32 %3)
%8 = tail call i32 @strlen(i8* %1)
%9 = add nsw i32 %8, -1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 13
br i1 %13, label %14, label %15
14: ; preds = %4
store i8 0, i8* %11
br label %15
15: ; preds = %14, %4
%16 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @strncpy(i8* %2, i8* %17, i32 %3)
%19 = tail call i32 @strlen(i8* %2)
%20 = add nsw i32 %19, -1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %2, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 13
br i1 %24, label %25, label %26
25: ; preds = %15
store i8 0, i8* %22
br label %26
26: ; preds = %25, %15
ret void
}