#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ conf_char_to_escape(unsigned int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputc(char const, int /*<<< orphan*/ *);
void conf_print_strval(const char *v, FILE *out) {
  for (; *v; v++) {
    if (*v < ' ' || *v & 0x80) {
      conf_char_to_escape((unsigned int)*v, out);
      continue;
    }
    if (*v == '"' || *v == '\\')
      fputc('\\', out);
    fputc(*v, out);
  }
}


x86 assembly (clang, -O0):
<conf_print_strval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11c8 <conf_print_strval+0xa8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jl     1162 <conf_print_strval+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1177 <conf_print_strval+0x57>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1040 <conf_char_to_escape@plt>
jmp    11b7 <conf_print_strval+0x97>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
je     1197 <conf_print_strval+0x77>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    11a5 <conf_print_strval+0x85>
mov    -0x10(%rbp),%rsi
mov    $0x5c,%edi
call   1030 <fputc@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1130 <conf_print_strval+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conf_print_strval>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1180 <conf_print_strval+0x60>
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    1156 <conf_print_strval+0x36>
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edi
mov    %r14,%rsi
call   1040 <conf_char_to_escape@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1180 <conf_print_strval+0x60>
cmp    $0x1f,%al
jle    1140 <conf_print_strval+0x20>
cmp    $0x5c,%al
je     1162 <conf_print_strval+0x42>
cmp    $0x22,%al
jne    1173 <conf_print_strval+0x53>
mov    $0x5c,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
movzbl -0x1(%rbx),%eax
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
jmp    114b <conf_print_strval+0x2b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @conf_print_strval(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
br label %5
5: ; preds = %44, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %47
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp slt i32 %12, 32
br i1 %13, label %20, label %14
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = and i32 %17, 128
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %14, %9
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = load i32*, i32** %4
%25 = call i32 @conf_char_to_escape(i32 %23, i32* %24)
br label %44
26: ; preds = %14
%27 = load i8*, i8** %3
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 34
br i1 %30, label %36, label %31
31: ; preds = %26
%32 = load i8*, i8** %3
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 92
br i1 %35, label %36, label %39
36: ; preds = %31, %26
%37 = load i32*, i32** %4
%38 = call i32 @fputc(i8 signext 92, i32* %37)
br label %39
39: ; preds = %36, %31
%40 = load i8*, i8** %3
%41 = load i8, i8* %40
%42 = load i32*, i32** %4
%43 = call i32 @fputc(i8 signext %41, i32* %42)
br label %44
44: ; preds = %39, %20
%45 = load i8*, i8** %3
%46 = getelementptr inbounds i8, i8* %45, i32 1
store i8* %46, i8** %3
br label %5
47: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @conf_print_strval(i8* nocapture %0, i32* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %23, label %5
5: ; preds = %2, %19
%6 = phi i8 [ %21, %19 ], [ %3, %2 ]
%7 = phi i8* [ %20, %19 ], [ %0, %2 ]
%8 = icmp slt i8 %6, 32
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = sext i8 %6 to i32
%11 = tail call i32 @conf_char_to_escape(i32 %10, i32* %1)
br label %19
12: ; preds = %5
switch i8 %6, label %16 [
i8 34, label %13
i8 92, label %13
]
13: ; preds = %12, %12
%14 = tail call i32 @fputc(i8 signext 92, i32* %1)
%15 = load i8, i8* %7
br label %16
16: ; preds = %12, %13
%17 = phi i8 [ %6, %12 ], [ %15, %13 ]
%18 = tail call i32 @fputc(i8 signext %17, i32* %1)
br label %19
19: ; preds = %16, %9
%20 = getelementptr inbounds i8, i8* %7, i64 1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %5
23: ; preds = %19, %2
ret void
}