#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*/ printf(char *, ...);
int strlen(char *);
int main() {
  char str[] = "OpenHouse 2016";
  char key = 88;
  printf("String: ");
  for (unsigned int i = 0; i < strlen(str); i++) {
    printf("0x%x, ", str[i] ^ key);
  }
  printf("\nLength: %d\n", strlen(str));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xec2(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xeba(%rip),%al
mov    %al,-0x5(%rbp)
movb   $0x58,-0x14(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    -0x13(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jae    11b6 <main+0x96>
mov    -0x18(%rbp),%eax
movsbl -0x13(%rbp,%rax,1),%esi
movsbl -0x14(%rbp),%eax
xor    %eax,%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1170 <main+0x50>
lea    -0x13(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movabs $0x36313032206573,%rax
mov    %rax,0x7(%rsp)
movabs $0x73756f486e65704f,%rax
6f 75 73
mov    %rax,(%rsp)
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
je     1194 <main+0x74>
lea    0xeb1(%rip),%r14
mov    %rsp,%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%rsp,%rbx,1),%esi
xor    $0x58,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %eax,%eax
cmp    %rax,%rbx
jb     1170 <main+0x50>
mov    %rsp,%rdi
call   1030 <strlen@plt>
lea    0xe7c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.str = [15 x i8] c"OpenHouse 2016\00"
@.str = [9 x i8] c"String: \00"
@.str.1 = [7 x i8] c"0x%x, \00"
@.str.2 = [13 x i8] c"\0ALength: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca i8
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [15 x i8]* %2 to i8*
store i8 88, i8* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %7
7: ; preds = %22, %0
%8 = load i32, i32* %4
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = icmp ult i32 %8, %10
br i1 %11, label %12, label %25
12: ; preds = %7
%13 = load i32, i32* %4
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = xor i32 %17, %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %12
%23 = load i32, i32* %4
%24 = add i32 %23, 1
store i32 %24, i32* %4
br label %7
25: ; preds = %7
%26 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%27 = call i32 @strlen(i8* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [15 x i8] c"OpenHouse 2016\00"
@.str = [9 x i8] c"String: \00"
@.str.1 = [7 x i8] c"0x%x, \00"
@.str.2 = [13 x i8] c"\0ALength: %d\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @strlen(i8* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %9, %0
%7 = call i32 @strlen(i8* %2)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
9: ; preds = %0, %9
%10 = phi i64 [ %16, %9 ], [ 0, %0 ]
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = xor i8 %12, 88
%14 = sext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = add nuw nsw i64 %10, 1
%17 = call i32 @strlen(i8* %2)
%18 = zext i32 %17 to i64
%19 = icmp ult i64 %16, %18
br i1 %19, label %9, label %6
}