#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*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned char);
int /*<<< orphan*/ putc(unsigned char, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void print_seq(char *seq, int len) {
  while (len--) {
    unsigned char ch = *(seq++);
    if (ch == '\033') {
      fputs(("esc "), stdout);
      continue;
    }
    if (ch < ' ') {
      putc((unsigned char)('^'), stdout);
      ch |= '@';
    }
    if (ch == ' ')
      fputs(("space "), stdout);
    else if (ch == 0x7f)
      fputs(("del "), stdout);
    else if (ch & 0x80)
      printf("\\%03o ", ch);
    else
      printf("%c ", ch);
  }
}


x86 assembly (clang, -O0):
<print_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     124c <print_seq+0x11c>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
cmp    $0x1b,%eax
jne    118e <print_seq+0x5e>
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
lea    0xe7c(%rip),%rdi
call   1040 <fputs@plt>
jmp    113f <print_seq+0xf>
movzbl -0xd(%rbp),%eax
cmp    $0x20,%eax
jge    11b8 <print_seq+0x88>
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
mov    $0x5e,%edi
call   1050 <putc@plt>
movzbl -0xd(%rbp),%eax
or     $0x40,%eax
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
cmp    $0x20,%eax
jne    11df <print_seq+0xaf>
mov    0x2e14(%rip),%rax
mov    (%rax),%esi
lea    0xe30(%rip),%rdi
call   1040 <fputs@plt>
jmp    1247 <print_seq+0x117>
movzbl -0xd(%rbp),%eax
cmp    $0x7f,%eax
jne    1206 <print_seq+0xd6>
mov    0x2ded(%rip),%rax
mov    (%rax),%esi
lea    0xe10(%rip),%rdi
call   1040 <fputs@plt>
jmp    1242 <print_seq+0x112>
movzbl -0xd(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     122d <print_seq+0xfd>
lea    0xdf2(%rip),%rdi
movzbl -0xd(%rbp),%esi
call   1030 <printf@plt>
jmp    123d <print_seq+0x10d>
lea    0xde4(%rip),%rdi
movzbl -0xd(%rbp),%esi
call   1030 <printf@plt>
jmp    1242 <print_seq+0x112>
jmp    1247 <print_seq+0x117>
jmp    113f <print_seq+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_seq>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     11da <print_seq+0xaa>
mov    %rdi,%rbx
mov    %esi,%ebp
xor    %r13d,%r13d
mov    0x2e8e(%rip),%r15
lea    0xea7(%rip),%r14
jmp    1174 <print_seq+0x44>
nopl   0x0(%rax,%rax,1)
mov    (%r15),%esi
mov    %r14,%rdi
call   1040 <fputs@plt>
add    $0x1,%r13
cmp    %r13d,%ebp
je     11da <print_seq+0xaa>
movzbl (%rbx,%r13,1),%r12d
cmp    $0x1b,%r12b
je     1160 <print_seq+0x30>
cmp    $0x1f,%r12b
ja     1196 <print_seq+0x66>
mov    (%r15),%esi
mov    $0x5e,%edi
call   1050 <putc@plt>
or     $0x40,%r12b
cmp    $0x7f,%r12b
je     11ae <print_seq+0x7e>
cmp    $0x20,%r12b
jne    11ba <print_seq+0x8a>
mov    (%r15),%esi
lea    0xe59(%rip),%rdi
jmp    1166 <print_seq+0x36>
mov    (%r15),%esi
lea    0xe54(%rip),%rdi
jmp    1166 <print_seq+0x36>
movzbl %r12b,%esi
test   %r12b,%r12b
js     11cc <print_seq+0x9c>
lea    0xe4e(%rip),%rdi
jmp    11d3 <print_seq+0xa3>
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
jmp    116b <print_seq+0x3b>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"esc \00"
@stdout = global i32 0
@.str.1 = [7 x i8] c"space \00"
@.str.2 = [5 x i8] c"del \00"
@.str.3 = [7 x i8] c"\\%03o \00"
@.str.4 = [4 x i8] c"%c \00"
define void @print_seq(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %6
6: ; preds = %58, %17, %2
%7 = load i32, i32* %4
%8 = add nsw i32 %7, -1
store i32 %8, i32* %4
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %59
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
store i8 %13, i8* %5
%14 = load i8, i8* %5
%15 = zext i8 %14 to i32
%16 = icmp eq i32 %15, 27
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = load i32, i32* @stdout
%19 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %6
20: ; preds = %10
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = icmp slt i32 %22, 32
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = load i32, i32* @stdout
%26 = call i32 @putc(i8 zeroext 94, i32 %25)
%27 = load i8, i8* %5
%28 = zext i8 %27 to i32
%29 = or i32 %28, 64
%30 = trunc i32 %29 to i8
store i8 %30, i8* %5
br label %31
31: ; preds = %24, %20
%32 = load i8, i8* %5
%33 = zext i8 %32 to i32
%34 = icmp eq i32 %33, 32
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* @stdout
%37 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %58
38: ; preds = %31
%39 = load i8, i8* %5
%40 = zext i8 %39 to i32
%41 = icmp eq i32 %40, 127
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i32, i32* @stdout
%44 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %43)
br label %57
45: ; preds = %38
%46 = load i8, i8* %5
%47 = zext i8 %46 to i32
%48 = and i32 %47, 128
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %45
%51 = load i8, i8* %5
%52 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %51)
br label %56
53: ; preds = %45
%54 = load i8, i8* %5
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %54)
br label %56
56: ; preds = %53, %50
br label %57
57: ; preds = %56, %42
br label %58
58: ; preds = %57, %35
br label %6
59: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"esc \00"
@stdout = global i32 0
@.str.1 = [7 x i8] c"space \00"
@.str.2 = [5 x i8] c"del \00"
@.str.3 = [7 x i8] c"\\%03o \00"
@.str.4 = [4 x i8] c"%c \00"
define void @print_seq(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %36, label %4
4: ; preds = %2, %34
%5 = phi i32 [ %7, %34 ], [ %1, %2 ]
%6 = phi i8* [ %8, %34 ], [ %0, %2 ]
%7 = add nsw i32 %5, -1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 27
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i32, i32* @stdout
%13 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %34
14: ; preds = %4
%15 = icmp ult i8 %9, 32
br i1 %15, label %16, label %20
16: ; preds = %14
%17 = load i32, i32* @stdout
%18 = tail call i32 @putc(i8 zeroext 94, i32 %17)
%19 = or i8 %9, 64
br label %20
20: ; preds = %16, %14
%21 = phi i8 [ %19, %16 ], [ %9, %14 ]
switch i8 %21, label %28 [
i8 32, label %22
i8 127, label %25
]
22: ; preds = %20
%23 = load i32, i32* @stdout
%24 = tail call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %34
25: ; preds = %20
%26 = load i32, i32* @stdout
%27 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %34
28: ; preds = %20
%29 = icmp sgt i8 %21, -1
br i1 %29, label %32, label %30
30: ; preds = %28
%31 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %21)
br label %34
32: ; preds = %28
%33 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %21)
br label %34
34: ; preds = %22, %30, %32, %25, %11
%35 = icmp eq i32 %7, 0
br i1 %35, label %36, label %4
36: ; preds = %34, %2
ret void
}