#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printChar(int);
void printStr(char *x) {
  while (1) {
    uint32_t *y = (uint32_t *)(((uint32_t)x) & ~0x3);
    uint32_t fullC = *y;
    uint32_t mod = ((uint32_t)x) & 0x3;
    uint32_t shift = mod << 3;
    uint32_t c = (fullC >> shift) & 0xFF;
    if (c == (uint32_t)'\0')
      break;
    printChar(c);
    x++;
  }
}


x86 assembly (clang, -O0):
<printStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfffffffc,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    1164 <printStr+0x54>
jmp    117d <printStr+0x6d>
mov    -0x20(%rbp),%edi
call   1030 <printChar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <printStr+0xc>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printStr>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rax
movslq %eax,%rcx
mov    %rcx,%rdx
and    $0xfffffffffffffffc,%rdx
mov    (%rdx),%edi
shl    $0x3,%ecx
sar    %cl,%edi
and    $0xff,%edi
je     1177 <printStr+0x67>
movabs $0x100000000,%r14
mov    %rax,%rbx
shl    $0x20,%rbx
add    %r14,%rbx
lea    0x8(,%rax,8),%ebp
nopl   0x0(%rax,%rax,1)
call   1030 <printChar@plt>
mov    %rbx,%rax
sar    $0x20,%rax
and    $0xfffffffffffffffc,%rax
mov    (%rax),%edi
mov    %ebp,%ecx
and    $0x18,%cl
sar    %cl,%edi
add    %r14,%rbx
add    $0x8,%ebp
and    $0xff,%edi
jne    1150 <printStr+0x40>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @printStr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
br label %8
8: ; preds = %1, %28
%9 = load i8*, i8** %2
%10 = ptrtoint i8* %9 to i32
%11 = and i32 %10, -4
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %3
%14 = load i32*, i32** %3
%15 = load i32, i32* %14
store i32 %15, i32* %4
%16 = load i8*, i8** %2
%17 = ptrtoint i8* %16 to i32
%18 = and i32 %17, 3
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = shl i32 %19, 3
store i32 %20, i32* %6
%21 = load i32, i32* %4
%22 = load i32, i32* %6
%23 = ashr i32 %21, %22
%24 = and i32 %23, 255
store i32 %24, i32* %7
%25 = load i32, i32* %7
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %8
br label %33
28: ; preds = %8
%29 = load i32, i32* %7
%30 = call i32 @printChar(i32 %29)
%31 = load i8*, i8** %2
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %2
br label %8
33: ; preds = %27
ret void
}

LLVM IR (-O2):
define void @printStr(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = shl i64 %2, 32
%5 = ashr exact i64 %4, 32
%6 = and i64 %5, -4
%7 = inttoptr i64 %6 to i32*
%8 = load i32, i32* %7
%9 = shl i32 %3, 3
%10 = and i32 %9, 24
%11 = ashr i32 %8, %10
%12 = and i32 %11, 255
%13 = icmp eq i32 %12, 0
br i1 %13, label %31, label %14
14: ; preds = %1, %14
%15 = phi i32 [ %29, %14 ], [ %12, %1 ]
%16 = phi i8* [ %18, %14 ], [ %0, %1 ]
%17 = tail call i32 @printChar(i32 %15)
%18 = getelementptr inbounds i8, i8* %16, i64 1
%19 = ptrtoint i8* %18 to i64
%20 = trunc i64 %19 to i32
%21 = shl i64 %19, 32
%22 = ashr exact i64 %21, 32
%23 = and i64 %22, -4
%24 = inttoptr i64 %23 to i32*
%25 = load i32, i32* %24
%26 = shl i32 %20, 3
%27 = and i32 %26, 24
%28 = ashr i32 %25, %27
%29 = and i32 %28, 255
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %14
31: ; preds = %14, %1
ret void
}