#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 *, ...);
void print32(const unsigned char *k) {
  int i;
  printf("0");
  for (i = 0; i < 32; ++i)
    printf("+%u*256^%d", (i == 31 ? 127 : 255) & (int)k[i], i);
}


x86 assembly (clang, -O0):
<print32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    117b <print32+0x6b>
mov    -0xc(%rbp),%ecx
mov    $0xff,%esi
mov    $0x7f,%eax
cmp    $0x1f,%ecx
cmove  %eax,%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
and    %eax,%esi
mov    -0xc(%rbp),%edx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <print32+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print32>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0x30,%edi
call   1030 <putchar@plt>
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
cmp    $0x1f,%rbx
setne  %al
shl    $0x7,%eax
or     $0x7f,%eax
movzbl (%r15,%rbx,1),%esi
and    %eax,%esi
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    1140 <print32+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [11 x i8] c"+%u*256^%d\00"
define void @print32(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %5
5: ; preds = %22, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 32
br i1 %7, label %8, label %25
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 31
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 127, i32 255
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = and i32 %12, %18
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20)
br label %22
22: ; preds = %8
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %5
25: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"+%u*256^%d\00"
define void @print32(i8* nocapture %0) {
%2 = tail call i32 @putchar(i32 48)
br label %3
3: ; preds = %1, %3
%4 = phi i64 [ 0, %1 ], [ %13, %3 ]
%5 = icmp eq i64 %4, 31
%6 = select i1 %5, i32 127, i32 255
%7 = getelementptr inbounds i8, i8* %0, i64 %4
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = and i32 %6, %9
%11 = trunc i64 %4 to i32
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %11)
%13 = add nuw nsw i64 %4, 1
%14 = icmp eq i64 %13, 32
br i1 %14, label %15, label %3
15: ; preds = %3
ret void
}