#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*/ printf(char *);
char *strdup(char *);
int /*<<< orphan*/ *strstr(char *, char *);
void MultilineCommentOrString(char *prefix, char **ret_string) {
  char *endposition;
  if (ret_string) {
    if (strstr(prefix + 2, "]]") != NULL) {
      *ret_string = strdup("Multiline comment or string");
    } else {
      *ret_string = strdup("Multiline comment mismatch");
      printf("mismatched [[\n");
    }
  }
}


x86 assembly (clang, -O0):
<MultilineCommentOrString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11ab <MultilineCommentOrString+0x7b>
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
lea    0xea6(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     1184 <MultilineCommentOrString+0x54>
lea    0xe93(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    11a6 <MultilineCommentOrString+0x76>
lea    0xe94(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    11ab <MultilineCommentOrString+0x7b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MultilineCommentOrString>:
push   %rbx
test   %rsi,%rsi
je     115d <MultilineCommentOrString+0x2d>
mov    %rsi,%rbx
add    $0x2,%rdi
lea    0xebc(%rip),%rsi
call   1050 <strstr@plt>
test   %rax,%rax
je     115f <MultilineCommentOrString+0x2f>
lea    0xeae(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,(%rbx)
pop    %rbx
ret
lea    0xeb9(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,(%rbx)
lea    0xec5(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"]]\00"
@.str.1 = [28 x i8] c"Multiline comment or string\00"
@.str.2 = [27 x i8] c"Multiline comment mismatch\00"
@.str.3 = [15 x i8] c"mismatched [[\0A\00"
define void @MultilineCommentOrString(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i8*
store i8* %0, i8** %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %4
%7 = icmp ne i8** %6, null
br i1 %7, label %8, label %21
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 2
%11 = call i32* @strstr(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = call i8* @strdup(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%15 = load i8**, i8*** %4
store i8* %14, i8** %15
br label %20
16: ; preds = %8
%17 = call i8* @strdup(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%18 = load i8**, i8*** %4
store i8* %17, i8** %18
%19 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %16, %13
br label %21
21: ; preds = %20, %2
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"]]\00"
@.str.1 = [28 x i8] c"Multiline comment or string\00"
@.str.2 = [27 x i8] c"Multiline comment mismatch\00"
@str = [14 x i8] c"mismatched [[\00"
define void @MultilineCommentOrString(i8* %0, i8** writeonly %1) {
%3 = icmp eq i8** %1, null
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = tail call i32* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call dereferenceable_or_null(28) i8* @strdup(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
store i8* %9, i8** %1
br label %13
10: ; preds = %4
%11 = tail call dereferenceable_or_null(27) i8* @strdup(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store i8* %11, i8** %1
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %8, %10, %2
ret void
}