#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 *);
void strScramble(char *s) {
  char *cp = s - 1;
  while (*++cp) {
    if ((unsigned char)*cp == 255)
      die("clsv_scramble: cannot scramble 0xFF");
    *cp = *cp ^ 255;
  }
}


x86 assembly (clang, -O0):
<strScramble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,0x1(%rax)
je     1178 <strScramble+0x68>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xff,%eax
jne    115f <strScramble+0x4f>
lea    0xea6(%rip),%rdi
call   1030 <die@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
xor    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
jmp    1128 <strScramble+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strScramble>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee2(%rip),%r14
jmp    1133 <strScramble+0x23>
mov    %r14,%rdi
call   1030 <die@plt>
movzbl (%rbx),%eax
not    %al
mov    %al,(%rbx)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0xff,%al
je     1120 <strScramble+0x10>
test   %al,%al
jne    112b <strScramble+0x1b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [36 x i8] c"clsv_scramble: cannot scramble 0xFF\00"
define void @strScramble(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 -1
br label %3
3: ; preds = %10, %1
%4 = phi i8* [ %2, %1 ], [ %5, %10 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %5
switch i8 %6, label %10 [
i8 0, label %13
i8 -1, label %7
]
7: ; preds = %3
%8 = tail call i32 @die(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%9 = load i8, i8* %5
br label %10
10: ; preds = %3, %7
%11 = phi i8 [ %6, %3 ], [ %9, %7 ]
%12 = xor i8 %11, -1
store i8 %12, i8* %5
br label %3
13: ; preds = %3
ret void
}