#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*/ die(char *);
int /*<<< orphan*/ is_triple_quote(char **);
void rm_next_triple_quote(char **s) {
  while (!is_triple_quote(s)) {
    if (**s == '\0')
      die("no closing triple quote");
    (*s)++;
  }
  **s = '\0';
  (*s) += 3;
}


x86 assembly (clang, -O0):
<rm_next_triple_quote>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <is_triple_quote@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    114a <rm_next_triple_quote+0x2a>
jmp    117c <rm_next_triple_quote+0x5c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1169 <rm_next_triple_quote+0x49>
lea    0xe9c(%rip),%rdi
call   1040 <die@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    112c <rm_next_triple_quote+0xc>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x3,%rcx
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rm_next_triple_quote>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <is_triple_quote@plt>
test   %eax,%eax
je     1142 <rm_next_triple_quote+0x22>
mov    (%rbx),%rax
movb   $0x0,(%rax)
addq   $0x3,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xeb7(%rip),%r14
jmp    1163 <rm_next_triple_quote+0x43>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %rbx,%rdi
call   1030 <is_triple_quote@plt>
test   %eax,%eax
jne    1130 <rm_next_triple_quote+0x10>
mov    (%rbx),%rax
cmpb   $0x0,(%rax)
jne    1150 <rm_next_triple_quote+0x30>
mov    %r14,%rdi
call   1040 <die@plt>
mov    (%rbx),%rax
jmp    1150 <rm_next_triple_quote+0x30>

LLVM IR (-O0):
@.str = [24 x i8] c"no closing triple quote\00"
define void @rm_next_triple_quote(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
br label %3
3: ; preds = %16, %1
%4 = load i8**, i8*** %2
%5 = call i32 @is_triple_quote(i8** %4)
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %8, label %20
8: ; preds = %3
%9 = load i8**, i8*** %2
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = call i32 @die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %8
%17 = load i8**, i8*** %2
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %17
br label %3
20: ; preds = %3
%21 = load i8**, i8*** %2
%22 = load i8*, i8** %21
store i8 0, i8* %22
%23 = load i8**, i8*** %2
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8, i8* %24, i64 3
store i8* %25, i8** %23
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"no closing triple quote\00"
define void @rm_next_triple_quote(i8** %0) {
%2 = tail call i32 @is_triple_quote(i8** %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %16
4: ; preds = %1, %11
%5 = load i8*, i8** %0
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = tail call i32 @die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%10 = load i8*, i8** %0
br label %11
11: ; preds = %8, %4
%12 = phi i8* [ %10, %8 ], [ %5, %4 ]
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8* %13, i8** %0
%14 = tail call i32 @is_triple_quote(i8** %0)
%15 = icmp eq i32 %14, 0
br i1 %15, label %4, label %16
16: ; preds = %11, %1
%17 = load i8*, i8** %0
store i8 0, i8* %17
%18 = load i8*, i8** %0
%19 = getelementptr inbounds i8, i8* %18, i64 3
store i8* %19, i8** %0
ret void
}