#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 */
scalar_t__ isprint(int);
int /*<<< orphan*/ printf(char *, unsigned char const);
int /*<<< orphan*/ putchar(unsigned char const);
void show_filename(const unsigned char *s) {
  int n;
  for (n = 0; n < 10; n++) {
    if (isprint(0xFF & s[n]))
      putchar(s[n]);
    else
      printf("\\0%o", s[n]);
  }
}


x86 assembly (clang, -O0):
<show_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    11af <show_filename+0x7f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
and    $0xff,%edi
call   1050 <isprint@plt>
cmp    $0x0,%rax
je     1184 <show_filename+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    119c <show_filename+0x6c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
lea    0xe6d(%rip),%rdi
movzbl (%rax,%rcx,1),%esi
call   1040 <printf@plt>
jmp    11a1 <show_filename+0x71>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <show_filename+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_filename>:
push   %rbx
mov    %rdi,%rbx
movzbl (%rdi),%edi
call   1050 <isprint@plt>
mov    (%rbx),%cl
test   %rax,%rax
je     114d <show_filename+0x1d>
movzbl %cl,%edi
call   1030 <putchar@plt>
jmp    115c <show_filename+0x2c>
movzbl %cl,%esi
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
movzbl 0x1(%rbx),%edi
call   1050 <isprint@plt>
mov    0x1(%rbx),%cl
test   %rax,%rax
je     1177 <show_filename+0x47>
movzbl %cl,%edi
call   1030 <putchar@plt>
jmp    1186 <show_filename+0x56>
movzbl %cl,%esi
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
movzbl 0x2(%rbx),%edi
call   1050 <isprint@plt>
mov    0x2(%rbx),%cl
test   %rax,%rax
je     11a1 <show_filename+0x71>
movzbl %cl,%edi
call   1030 <putchar@plt>
jmp    11b0 <show_filename+0x80>
movzbl %cl,%esi
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
movzbl 0x3(%rbx),%edi
call   1050 <isprint@plt>
mov    0x3(%rbx),%cl
test   %rax,%rax
je     11cb <show_filename+0x9b>
movzbl %cl,%edi
call   1030 <putchar@plt>
jmp    11da <show_filename+0xaa>
movzbl %cl,%esi
lea    0xe2b(%rip),%rdi
call   1040 <printf@plt>
movzbl 0x4(%rbx),%edi
call   1050 <isprint@plt>
mov    0x4(%rbx),%cl
test   %rax,%rax
je     11f5 <show_filename+0xc5>
movzbl %cl,%edi
call   1030 <putchar@plt>
jmp    1204 <show_filename+0xd4>
movzbl %cl,%esi
lea    0xe01(%rip),%rdi
call   1040 <printf@plt>
movzbl 0x5(%rbx),%edi
call   1050 <isprint@plt>
mov    0x5(%rbx),%cl
test   %rax,%rax
je     121f <show_filename+0xef>
movzbl %cl,%edi
call   1030 <putchar@plt>
jmp    122e <show_filename+0xfe>
movzbl %cl,%esi
lea    0xdd7(%rip),%rdi
call   1040 <printf@plt>
movzbl 0x6(%rbx),%edi
call   1050 <isprint@plt>
mov    0x6(%rbx),%cl
test   %rax,%rax
je     1249 <show_filename+0x119>
movzbl %cl,%edi
call   1030 <putchar@plt>
jmp    1258 <show_filename+0x128>
movzbl %cl,%esi
lea    0xdad(%rip),%rdi
call   1040 <printf@plt>
movzbl 0x7(%rbx),%edi
call   1050 <isprint@plt>
mov    0x7(%rbx),%cl
test   %rax,%rax
je     1273 <show_filename+0x143>
movzbl %cl,%edi
call   1030 <putchar@plt>
jmp    1282 <show_filename+0x152>
movzbl %cl,%esi
lea    0xd83(%rip),%rdi
call   1040 <printf@plt>
movzbl 0x8(%rbx),%edi
call   1050 <isprint@plt>
mov    0x8(%rbx),%cl
test   %rax,%rax
je     129d <show_filename+0x16d>
movzbl %cl,%edi
call   1030 <putchar@plt>
jmp    12ac <show_filename+0x17c>
movzbl %cl,%esi
lea    0xd59(%rip),%rdi
call   1040 <printf@plt>
movzbl 0x9(%rbx),%edi
call   1050 <isprint@plt>
mov    0x9(%rbx),%cl
test   %rax,%rax
je     12c6 <show_filename+0x196>
movzbl %cl,%edi
pop    %rbx
jmp    1030 <putchar@plt>
movzbl %cl,%esi
lea    0xd30(%rip),%rdi
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\\0%o\00"
define void @show_filename(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %32, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %35
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = and i32 255, %13
%15 = call i64 @isprint(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %7
%18 = load i8*, i8** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = call i32 @putchar(i8 zeroext %22)
br label %31
24: ; preds = %7
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %29)
br label %31
31: ; preds = %24, %17
br label %32
32: ; preds = %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %4
35: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\\0%o\00"
define void @show_filename(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = tail call i64 @isprint(i32 %3)
%5 = icmp eq i64 %4, 0
%6 = load i8, i8* %0
br i1 %5, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @putchar(i8 zeroext %6)
br label %11
9: ; preds = %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
br label %11
11: ; preds = %7, %9
%12 = getelementptr inbounds i8, i8* %0, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = tail call i64 @isprint(i32 %14)
%16 = icmp eq i64 %15, 0
%17 = load i8, i8* %12
br i1 %16, label %20, label %18
18: ; preds = %11
%19 = tail call i32 @putchar(i8 zeroext %17)
br label %22
20: ; preds = %11
%21 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %17)
br label %22
22: ; preds = %20, %18
%23 = getelementptr inbounds i8, i8* %0, i64 2
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = tail call i64 @isprint(i32 %25)
%27 = icmp eq i64 %26, 0
%28 = load i8, i8* %23
br i1 %27, label %31, label %29
29: ; preds = %22
%30 = tail call i32 @putchar(i8 zeroext %28)
br label %33
31: ; preds = %22
%32 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %28)
br label %33
33: ; preds = %31, %29
%34 = getelementptr inbounds i8, i8* %0, i64 3
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = tail call i64 @isprint(i32 %36)
%38 = icmp eq i64 %37, 0
%39 = load i8, i8* %34
br i1 %38, label %42, label %40
40: ; preds = %33
%41 = tail call i32 @putchar(i8 zeroext %39)
br label %44
42: ; preds = %33
%43 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %39)
br label %44
44: ; preds = %42, %40
%45 = getelementptr inbounds i8, i8* %0, i64 4
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = tail call i64 @isprint(i32 %47)
%49 = icmp eq i64 %48, 0
%50 = load i8, i8* %45
br i1 %49, label %53, label %51
51: ; preds = %44
%52 = tail call i32 @putchar(i8 zeroext %50)
br label %55
53: ; preds = %44
%54 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %50)
br label %55
55: ; preds = %53, %51
%56 = getelementptr inbounds i8, i8* %0, i64 5
%57 = load i8, i8* %56
%58 = zext i8 %57 to i32
%59 = tail call i64 @isprint(i32 %58)
%60 = icmp eq i64 %59, 0
%61 = load i8, i8* %56
br i1 %60, label %64, label %62
62: ; preds = %55
%63 = tail call i32 @putchar(i8 zeroext %61)
br label %66
64: ; preds = %55
%65 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %61)
br label %66
66: ; preds = %64, %62
%67 = getelementptr inbounds i8, i8* %0, i64 6
%68 = load i8, i8* %67
%69 = zext i8 %68 to i32
%70 = tail call i64 @isprint(i32 %69)
%71 = icmp eq i64 %70, 0
%72 = load i8, i8* %67
br i1 %71, label %75, label %73
73: ; preds = %66
%74 = tail call i32 @putchar(i8 zeroext %72)
br label %77
75: ; preds = %66
%76 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %72)
br label %77
77: ; preds = %75, %73
%78 = getelementptr inbounds i8, i8* %0, i64 7
%79 = load i8, i8* %78
%80 = zext i8 %79 to i32
%81 = tail call i64 @isprint(i32 %80)
%82 = icmp eq i64 %81, 0
%83 = load i8, i8* %78
br i1 %82, label %86, label %84
84: ; preds = %77
%85 = tail call i32 @putchar(i8 zeroext %83)
br label %88
86: ; preds = %77
%87 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %83)
br label %88
88: ; preds = %86, %84
%89 = getelementptr inbounds i8, i8* %0, i64 8
%90 = load i8, i8* %89
%91 = zext i8 %90 to i32
%92 = tail call i64 @isprint(i32 %91)
%93 = icmp eq i64 %92, 0
%94 = load i8, i8* %89
br i1 %93, label %97, label %95
95: ; preds = %88
%96 = tail call i32 @putchar(i8 zeroext %94)
br label %99
97: ; preds = %88
%98 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %94)
br label %99
99: ; preds = %97, %95
%100 = getelementptr inbounds i8, i8* %0, i64 9
%101 = load i8, i8* %100
%102 = zext i8 %101 to i32
%103 = tail call i64 @isprint(i32 %102)
%104 = icmp eq i64 %103, 0
%105 = load i8, i8* %100
br i1 %104, label %108, label %106
106: ; preds = %99
%107 = tail call i32 @putchar(i8 zeroext %105)
br label %110
108: ; preds = %99
%109 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %105)
br label %110
110: ; preds = %108, %106
ret void
}