#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*/ strcpy(char *, char *);
int strlen(char *);
char *get_carrot_new_data(char *input_buffer) {
  static char new_data[4096] = {0};
  char *end_pointer = input_buffer + strlen(input_buffer);
  while (end_pointer > input_buffer) {
    if (*end_pointer == '^') {
      strcpy(new_data, end_pointer + 1);
      break;
    }
    end_pointer--;
  }
  return new_data;
}


x86 assembly (clang, -O0):
<get_carrot_new_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jbe    1195 <get_carrot_new_data+0x75>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5e,%eax
jne    1184 <get_carrot_new_data+0x64>
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
lea    0x2ec6(%rip),%rdi
call   1030 <strcpy@plt>
jmp    1195 <get_carrot_new_data+0x75>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    114d <get_carrot_new_data+0x2d>
lea    0x2ea4(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_carrot_new_data>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
test   %eax,%eax
jle    1160 <get_carrot_new_data+0x40>
mov    %eax,%esi
add    %rbx,%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x5e,(%rsi)
je     1150 <get_carrot_new_data+0x30>
add    $0xffffffffffffffff,%rsi
cmp    %rbx,%rsi
ja     1140 <get_carrot_new_data+0x20>
jmp    1160 <get_carrot_new_data+0x40>
add    $0x1,%rsi
lea    0x2ee5(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2ed9(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@get_carrot_new_data.new_data = internal global [4096 x i8] zeroinitializer
define i8* @get_carrot_new_data(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 %7
store i8* %8, i8** %3
br label %9
9: ; preds = %22, %1
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = icmp ugt i8* %10, %11
br i1 %12, label %13, label %25
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 94
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = call i32 @strcpy(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @get_carrot_new_data.new_data, i64 0, i64 0), i8* %20)
br label %25
22: ; preds = %13
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 -1
store i8* %24, i8** %3
br label %9
25: ; preds = %18, %9
ret i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @get_carrot_new_data.new_data, i64 0, i64 0)
}

LLVM IR (-O2):
@get_carrot_new_data.new_data = internal global [4096 x i8] zeroinitializer
define i8* @get_carrot_new_data(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %17
4: ; preds = %1
%5 = zext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
br label %7
7: ; preds = %4, %14
%8 = phi i8* [ %15, %14 ], [ %6, %4 ]
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 94
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = tail call i32 @strcpy(i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @get_carrot_new_data.new_data, i64 0, i64 0), i8* %12)
br label %17
14: ; preds = %7
%15 = getelementptr inbounds i8, i8* %8, i64 -1
%16 = icmp ugt i8* %15, %0
br i1 %16, label %7, label %17
17: ; preds = %14, %1, %11
ret i8* getelementptr inbounds ([4096 x i8], [4096 x i8]* @get_carrot_new_data.new_data, i64 0, i64 0)
}