#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 uint32_t;

/* Variables and functions */
char *malloc(int);
int strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
char *strstr(char const *, char const *);
void separate_test(const char *test_name, char **function, char **scenario,
                   char **expected_result) {
  const char *delimiter = "__";
  char *iterator_1 = NULL;
  char *iterator_2 = NULL;
  uint32_t length = 0;
  iterator_1 = strstr(test_name, delimiter);
  length = iterator_1 - test_name;
  *function = malloc(sizeof(char) * (length + 1));
  strncpy(*function, test_name, length);
  (*function)[length] = '\0';
  iterator_1 += 2 * sizeof(char);
  iterator_2 = strstr(iterator_1, delimiter);
  length = iterator_2 - iterator_1;
  *scenario = malloc(sizeof(char) * (length + 1));
  strncpy(*scenario, iterator_1, length);
  (*scenario)[length] = '\0';
  iterator_2 += 2 * sizeof(char);
  length = strlen(test_name) - (iterator_2 - test_name);
  *expected_result = malloc(sizeof(char) * (length + 1));
  strncpy(*expected_result, iterator_2, length);
  (*expected_result)[length] = '\0';
}


x86 assembly (clang, -O0):
<separate_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xea1(%rip),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <strstr@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x3c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x3c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <strstr@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x3c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x3c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x38(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cltq
mov    -0x38(%rbp),%rcx
mov    -0x8(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x3c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movslq -0x3c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<separate_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,(%rsp)
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
lea    0xea1(%rip),%rbp
mov    %rbp,%rsi
call   1060 <strstr@plt>
mov    %rax,%r14
mov    %rax,%rbx
sub    %r13,%rbx
lea    0x1(%rbx),%edi
call   1050 <malloc@plt>
mov    %rax,(%r12)
mov    %rax,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
mov    (%r12),%rax
movslq %ebx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x2,%r14
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <strstr@plt>
mov    %rax,%r12
mov    %rax,%rbx
sub    %r14,%rbx
lea    0x1(%rbx),%edi
call   1050 <malloc@plt>
mov    %rax,(%r15)
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
mov    (%r15),%rax
movslq %ebx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x2,%r12
mov    %r13,%rdi
call   1040 <strlen@plt>
sub    %r12d,%r13d
lea    (%rax,%r13,1),%ebx
lea    (%rax,%r13,1),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    (%rsp),%rbp
mov    %rax,0x0(%rbp)
mov    %rax,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
mov    0x0(%rbp),%rax
movslq %ebx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"__\00"
define void @separate_test(i8* %0, i8** %1, i8** %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %9
store i8* null, i8** %10
store i8* null, i8** %11
store i32 0, i32* %12
%13 = load i8*, i8** %5
%14 = load i8*, i8** %9
%15 = call i8* @strstr(i8* %13, i8* %14)
store i8* %15, i8** %10
%16 = load i8*, i8** %10
%17 = load i8*, i8** %5
%18 = ptrtoint i8* %16 to i64
%19 = ptrtoint i8* %17 to i64
%20 = sub i64 %18, %19
%21 = trunc i64 %20 to i32
store i32 %21, i32* %12
%22 = load i32, i32* %12
%23 = add nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = mul i64 1, %24
%26 = trunc i64 %25 to i32
%27 = call i8* @malloc(i32 %26)
%28 = load i8**, i8*** %6
store i8* %27, i8** %28
%29 = load i8**, i8*** %6
%30 = load i8*, i8** %29
%31 = load i8*, i8** %5
%32 = load i32, i32* %12
%33 = call i32 @strncpy(i8* %30, i8* %31, i32 %32)
%34 = load i8**, i8*** %6
%35 = load i8*, i8** %34
%36 = load i32, i32* %12
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
store i8 0, i8* %38
%39 = load i8*, i8** %10
%40 = getelementptr inbounds i8, i8* %39, i64 2
store i8* %40, i8** %10
%41 = load i8*, i8** %10
%42 = load i8*, i8** %9
%43 = call i8* @strstr(i8* %41, i8* %42)
store i8* %43, i8** %11
%44 = load i8*, i8** %11
%45 = load i8*, i8** %10
%46 = ptrtoint i8* %44 to i64
%47 = ptrtoint i8* %45 to i64
%48 = sub i64 %46, %47
%49 = trunc i64 %48 to i32
store i32 %49, i32* %12
%50 = load i32, i32* %12
%51 = add nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = mul i64 1, %52
%54 = trunc i64 %53 to i32
%55 = call i8* @malloc(i32 %54)
%56 = load i8**, i8*** %7
store i8* %55, i8** %56
%57 = load i8**, i8*** %7
%58 = load i8*, i8** %57
%59 = load i8*, i8** %10
%60 = load i32, i32* %12
%61 = call i32 @strncpy(i8* %58, i8* %59, i32 %60)
%62 = load i8**, i8*** %7
%63 = load i8*, i8** %62
%64 = load i32, i32* %12
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %63, i64 %65
store i8 0, i8* %66
%67 = load i8*, i8** %11
%68 = getelementptr inbounds i8, i8* %67, i64 2
store i8* %68, i8** %11
%69 = load i8*, i8** %5
%70 = call i32 @strlen(i8* %69)
%71 = sext i32 %70 to i64
%72 = load i8*, i8** %11
%73 = load i8*, i8** %5
%74 = ptrtoint i8* %72 to i64
%75 = ptrtoint i8* %73 to i64
%76 = sub i64 %74, %75
%77 = sub nsw i64 %71, %76
%78 = trunc i64 %77 to i32
store i32 %78, i32* %12
%79 = load i32, i32* %12
%80 = add nsw i32 %79, 1
%81 = sext i32 %80 to i64
%82 = mul i64 1, %81
%83 = trunc i64 %82 to i32
%84 = call i8* @malloc(i32 %83)
%85 = load i8**, i8*** %8
store i8* %84, i8** %85
%86 = load i8**, i8*** %8
%87 = load i8*, i8** %86
%88 = load i8*, i8** %11
%89 = load i32, i32* %12
%90 = call i32 @strncpy(i8* %87, i8* %88, i32 %89)
%91 = load i8**, i8*** %8
%92 = load i8*, i8** %91
%93 = load i32, i32* %12
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %92, i64 %94
store i8 0, i8* %95
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"__\00"
define void @separate_test(i8* %0, i8** nocapture %1, i8** nocapture %2, i8** nocapture %3) {
%5 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = ptrtoint i8* %5 to i64
%7 = ptrtoint i8* %0 to i64
%8 = sub i64 %6, %7
%9 = trunc i64 %8 to i32
%10 = add nsw i32 %9, 1
%11 = tail call i8* @malloc(i32 %10)
store i8* %11, i8** %1
%12 = tail call i32 @strncpy(i8* %11, i8* %0, i32 %9)
%13 = load i8*, i8** %1
%14 = shl i64 %8, 32
%15 = ashr exact i64 %14, 32
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 0, i8* %16
%17 = getelementptr inbounds i8, i8* %5, i64 2
%18 = tail call i8* @strstr(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = ptrtoint i8* %18 to i64
%20 = ptrtoint i8* %17 to i64
%21 = sub i64 %19, %20
%22 = trunc i64 %21 to i32
%23 = add nsw i32 %22, 1
%24 = tail call i8* @malloc(i32 %23)
store i8* %24, i8** %2
%25 = tail call i32 @strncpy(i8* %24, i8* %17, i32 %22)
%26 = load i8*, i8** %2
%27 = shl i64 %21, 32
%28 = ashr exact i64 %27, 32
%29 = getelementptr inbounds i8, i8* %26, i64 %28
store i8 0, i8* %29
%30 = getelementptr inbounds i8, i8* %18, i64 2
%31 = tail call i32 @strlen(i8* %0)
%32 = ptrtoint i8* %30 to i64
%33 = sub i64 %7, %32
%34 = trunc i64 %33 to i32
%35 = add i32 %31, %34
%36 = add nsw i32 %35, 1
%37 = tail call i8* @malloc(i32 %36)
store i8* %37, i8** %3
%38 = tail call i32 @strncpy(i8* %37, i8* %30, i32 %35)
%39 = load i8*, i8** %3
%40 = sext i32 %35 to i64
%41 = getelementptr inbounds i8, i8* %39, i64 %40
store i8 0, i8* %41
ret void
}