#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 */
char *s_strdup(char *);
char *strchr(char const *, char);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *parse_verify_uin(const char *str) {
  char *start;
  char *end;
  char uin[128] = {0};
  start = strchr(str, '\\');
  if (!start)
    return NULL;
  end = strchr(start, '\'');
  if (!end)
    return NULL;
  strncpy(uin, start, end - start);
  return s_strdup(uin);
}


x86 assembly (clang, -O0):
<parse_verify_uin>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5c,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118c <parse_verify_uin+0x4c>
movq   $0x0,-0x8(%rbp)
jmp    11e3 <parse_verify_uin+0xa3>
mov    -0x18(%rbp),%rdi
mov    $0x27,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11b6 <parse_verify_uin+0x76>
movq   $0x0,-0x8(%rbp)
jmp    11e3 <parse_verify_uin+0xa3>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <strncpy@plt>
lea    -0xa0(%rbp),%rdi
call   1060 <s_strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_verify_uin>:
push   %r14
push   %rbx
sub    $0x88,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    $0x5c,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11a4 <parse_verify_uin+0x74>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x27,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11a4 <parse_verify_uin+0x74>
sub    %ebx,%eax
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    %r14,%rdi
call   1050 <s_strdup@plt>
jmp    11a6 <parse_verify_uin+0x76>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @parse_verify_uin(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [128 x i8]
store i8* %0, i8** %3
%7 = bitcast [128 x i8]* %6 to i8*
%8 = load i8*, i8** %3
%9 = call i8* @strchr(i8* %8, i8 signext 92)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %1
store i8* null, i8** %2
br label %31
13: ; preds = %1
%14 = load i8*, i8** %4
%15 = call i8* @strchr(i8* %14, i8 signext 39)
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = icmp ne i8* %16, null
br i1 %17, label %19, label %18
18: ; preds = %13
store i8* null, i8** %2
br label %31
19: ; preds = %13
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%21 = load i8*, i8** %4
%22 = load i8*, i8** %5
%23 = load i8*, i8** %4
%24 = ptrtoint i8* %22 to i64
%25 = ptrtoint i8* %23 to i64
%26 = sub i64 %24, %25
%27 = trunc i64 %26 to i32
%28 = call i32 @strncpy(i8* %20, i8* %21, i32 %27)
%29 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%30 = call i8* @s_strdup(i8* %29)
store i8* %30, i8** %2
br label %31
31: ; preds = %19, %18, %12
%32 = load i8*, i8** %2
ret i8* %32
}

LLVM IR (-O2):
define i8* @parse_verify_uin(i8* %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 92)
%5 = icmp eq i8* %4, null
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = tail call i8* @strchr(i8* %4, i8 signext 39)
%8 = icmp eq i8* %7, null
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = ptrtoint i8* %7 to i64
%11 = ptrtoint i8* %4 to i64
%12 = sub i64 %10, %11
%13 = trunc i64 %12 to i32
%14 = call i32 @strncpy(i8* %3, i8* %4, i32 %13)
%15 = call i8* @s_strdup(i8* %3)
br label %16
16: ; preds = %6, %1, %9
%17 = phi i8* [ %15, %9 ], [ null, %1 ], [ null, %6 ]
ret i8* %17
}