#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*/ ft_putstr(char *);
int comment_end(char **comment, char *buff, int k, int i) {
  comment[0][k] = '\0';
  if (buff[i] != '"') {
    ft_putstr("Missing quote after comment\n");
    return (1);
  }
  if (k == (2048) + 1) {
    ft_putstr("Comment is too long\n");
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<comment_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
je     1162 <comment_end+0x52>
lea    0xeaf(%rip),%rdi
call   1030 <ft_putstr@plt>
movl   $0x1,-0x4(%rbp)
jmp    118e <comment_end+0x7e>
cmpl   $0x801,-0x1c(%rbp)
jne    1187 <comment_end+0x77>
lea    0xea7(%rip),%rdi
call   1030 <ft_putstr@plt>
movl   $0x1,-0x4(%rbp)
jmp    118e <comment_end+0x7e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comment_end>:
push   %rax
mov    (%rdi),%rax
movslq %edx,%rdi
movb   $0x0,(%rax,%rdi,1)
movslq %ecx,%rax
cmpb   $0x22,(%rsi,%rax,1)
jne    1137 <comment_end+0x27>
xor    %eax,%eax
cmp    $0x801,%edx
jne    1148 <comment_end+0x38>
lea    0xee8(%rip),%rdi
jmp    113e <comment_end+0x2e>
lea    0xec2(%rip),%rdi
call   1030 <ft_putstr@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Missing quote after comment\0A\00"
@.str.1 = [21 x i8] c"Comment is too long\0A\00"
define i32 @comment_end(i8** %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8** %0, i8*** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i8**, i8*** %6
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = load i32, i32* %8
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
store i8 0, i8* %15
%16 = load i8*, i8** %7
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 34
br i1 %22, label %23, label %25
23: ; preds = %4
%24 = call i32 @ft_putstr(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %5
br label %31
25: ; preds = %4
%26 = load i32, i32* %8
%27 = icmp eq i32 %26, 2049
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 @ft_putstr(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %5
br label %31
30: ; preds = %25
store i32 0, i32* %5
br label %31
31: ; preds = %30, %28, %23
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
@.str = [29 x i8] c"Missing quote after comment\0A\00"
@.str.1 = [21 x i8] c"Comment is too long\0A\00"
define i32 @comment_end(i8** nocapture %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = load i8*, i8** %0
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i8, i8* %5, i64 %6
store i8 0, i8* %7
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i8, i8* %1, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 34
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = icmp eq i32 %2, 2049
br i1 %13, label %14, label %17
14: ; preds = %12, %4
%15 = phi i8* [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %12 ]
%16 = tail call i32 @ft_putstr(i8* %15)
br label %17
17: ; preds = %14, %12
%18 = phi i32 [ 0, %12 ], [ 1, %14 ]
ret i32 %18
}