#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 print_representation(char repr[], int size) {
  int i;
  for (i = 0; i < size; i++) {
    printf("Segment %d:\n", i);
    printf("%s\n", repr[i] & 0x4 ? " __ " : "");
    printf("%s%s%s\n", (repr[i] & 0x8 ? "|" : " "),
           (repr[i] & 0x2 ? "__" : "  "), (repr[i] & 0x10 ? "|" : ""));
    printf("%s%s%s\n", (repr[i] & 0x20 ? "|" : " "),
           (repr[i] & 0x1 ? "__" : "  "), (repr[i] & 0x40 ? "|" : ""));
  }
}


x86 assembly (clang, -O0):
<print_representation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1277 <print_representation+0x167>
mov    -0x10(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
and    $0x4,%ecx
lea    0xeb3(%rip),%rsi
lea    0xead(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
and    $0x8,%ecx
lea    0xe95(%rip),%rsi
lea    0xe88(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
and    $0x2,%ecx
lea    0xe70(%rip),%rdx
lea    0xe66(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
and    $0x10,%edi
lea    0xe39(%rip),%rcx
lea    0xe40(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
and    $0x20,%ecx
lea    0xe1b(%rip),%rsi
lea    0xe0e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
and    $0x1,%ecx
lea    0xdf6(%rip),%rdx
lea    0xdec(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
and    $0x40,%edi
lea    0xdbf(%rip),%rcx
lea    0xdc6(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_representation+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_representation>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    120b <print_representation+0xeb>
mov    %rdi,%r14
mov    %esi,%eax
mov    %rax,0x8(%rsp)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xea9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
testb  $0x4,(%r14,%rbx,1)
lea    0xea1(%rip),%rdi
lea    0xe99(%rip),%r13
cmove  %r13,%rdi
call   1030 <puts@plt>
movzbl (%r14,%rbx,1),%eax
test   $0x8,%al
lea    0xe90(%rip),%r12
mov    %r12,%rsi
lea    0xe8c(%rip),%rcx
cmove  %rcx,%rsi
test   $0x2,%al
lea    0xe7b(%rip),%rdx
lea    0xe77(%rip),%r15
cmove  %r15,%rdx
test   $0x10,%al
mov    %r12,%rcx
cmove  %r13,%rcx
lea    0xe56(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl (%r14,%rbx,1),%eax
test   $0x20,%al
mov    %r12,%rsi
lea    0xe4c(%rip),%rcx
cmove  %rcx,%rsi
test   $0x1,%al
lea    0xe3b(%rip),%rdx
cmove  %r15,%rdx
test   $0x40,%al
cmove  %r13,%r12
lea    0xe20(%rip),%rdi
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,0x8(%rsp)
jne    1150 <print_representation+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Segment %d:\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [5 x i8] c" __ \00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [8 x i8] c"%s%s%s\0A\00"
@.str.5 = [2 x i8] c"|\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [3 x i8] c"__\00"
@.str.8 = [3 x i8] c" \00"
define void @print_representation(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %86, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %89
10: ; preds = %6
%11 = load i32, i32* %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i8*, i8** %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = and i32 %18, 4
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = load i8*, i8** %3
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = and i32 %29, 8
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%34 = load i8*, i8** %3
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = and i32 %39, 2
%41 = icmp ne i32 %40, 0
%42 = zext i1 %41 to i64
%43 = select i1 %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0)
%44 = load i8*, i8** %3
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = and i32 %49, 16
%51 = icmp ne i32 %50, 0
%52 = zext i1 %51 to i64
%53 = select i1 %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %33, i8* %43, i8* %53)
%55 = load i8*, i8** %3
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = and i32 %60, 32
%62 = icmp ne i32 %61, 0
%63 = zext i1 %62 to i64
%64 = select i1 %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0)
%65 = load i8*, i8** %3
%66 = load i32, i32* %5
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = and i32 %70, 1
%72 = icmp ne i32 %71, 0
%73 = zext i1 %72 to i64
%74 = select i1 %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0)
%75 = load i8*, i8** %3
%76 = load i32, i32* %5
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = and i32 %80, 64
%82 = icmp ne i32 %81, 0
%83 = zext i1 %82 to i64
%84 = select i1 %82, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %64, i8* %74, i8* %84)
br label %86
86: ; preds = %10
%87 = load i32, i32* %5
%88 = add nsw i32 %87, 1
store i32 %88, i32* %5
br label %6
89: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Segment %d:\0A\00"
@.str.2 = [5 x i8] c" __ \00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [8 x i8] c"%s%s%s\0A\00"
@.str.5 = [2 x i8] c"|\00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [3 x i8] c"__\00"
@.str.8 = [3 x i8] c" \00"
define void @print_representation(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %42
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %40, %6 ]
%8 = trunc i64 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds i8, i8* %0, i64 %7
%11 = load i8, i8* %10
%12 = and i8 %11, 4
%13 = icmp eq i8 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%15 = tail call i32 @puts(i8* dereferenceable(1) %14)
%16 = load i8, i8* %10
%17 = zext i8 %16 to i32
%18 = and i32 %17, 8
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%21 = and i32 %17, 2
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%24 = and i32 %17, 16
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %20, i8* %23, i8* %26)
%28 = load i8, i8* %10
%29 = zext i8 %28 to i32
%30 = and i32 %29, 32
%31 = icmp eq i32 %30, 0
%32 = select i1 %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%33 = and i32 %29, 1
%34 = icmp eq i32 %33, 0
%35 = select i1 %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%36 = and i32 %29, 64
%37 = icmp eq i32 %36, 0
%38 = select i1 %37, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %32, i8* %35, i8* %38)
%40 = add nuw nsw i64 %7, 1
%41 = icmp eq i64 %40, %5
br i1 %41, label %42, label %6
42: ; preds = %6, %2
ret void
}