#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 /*<<< orphan*/ ret;

/* Variables and functions */
int /*<<< orphan*/ strlcpy(char *, char *, int);
char *colorize(char *str) {
  static char ret[128];
  char *c = ret;
  strlcpy(ret, str, sizeof(ret));
  while (*c)
    *c++ += 128;
  return ret;
}


x86 assembly (clang, -O0):
<colorize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0x2f0e(%rip),%rdi
mov    $0x80,%edx
call   1030 <strlcpy@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1168 <colorize+0x58>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%ecx
add    $0x80,%ecx
mov    %cl,(%rax)
jmp    113c <colorize+0x2c>
lea    0x2ed1(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<colorize>:
push   %rax
mov    %rdi,%rsi
lea    0x2f25(%rip),%rdi
mov    $0x80,%edx
call   1030 <strlcpy@plt>
mov    0x2f15(%rip),%al
test   %al,%al
je     1150 <colorize+0x40>
lea    0x2f0b(%rip),%rcx
cs nopw 0x0(%rax,%rax,1)
xor    $0x80,%al
mov    %al,-0x1(%rcx)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    1140 <colorize+0x30>
lea    0x2ee9(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@colorize.ret = internal global [128 x i8] zeroinitializer
define i8* @colorize(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @colorize.ret, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = call i32 @strlcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @colorize.ret, i64 0, i64 0), i8* %4, i32 128)
br label %6
6: ; preds = %10, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = sext i8 %13 to i32
%15 = add nsw i32 %14, 128
%16 = trunc i32 %15 to i8
store i8 %16, i8* %11
br label %6
17: ; preds = %6
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @colorize.ret, i64 0, i64 0)
}

LLVM IR (-O2):
@colorize.ret = internal global [128 x i8] zeroinitializer
define i8* @colorize(i8* %0) {
%2 = tail call i32 @strlcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @colorize.ret, i64 0, i64 0), i8* %0, i32 128)
%3 = load i8, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @colorize.ret, i64 0, i64 0)
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %1, %5
%6 = phi i8 [ %10, %5 ], [ %3, %1 ]
%7 = phi i8* [ %8, %5 ], [ getelementptr inbounds ([128 x i8], [128 x i8]* @colorize.ret, i64 0, i64 0), %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = xor i8 %6, -128
store i8 %9, i8* %7
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %1
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @colorize.ret, i64 0, i64 0)
}