#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
int /*<<< orphan*/ op_write1(char);
int /*<<< orphan*/ stderr;
int strlen(char *);
void op_enc_db_ascii(char *str) {
  size_t size = strlen(str) - 1;
  for (size_t i = 0; i <= size; ++i) {
    if (str[i] == '\\') {
      switch (str[i + 1]) {
      case '0':
        op_write1(0x00);
        ++i;
        continue;
      default: {
        fprintf(stderr,
                "parse error: "
                "warning:ascii: unimplemented \\%c\n",
                str[i + 1]);
        exit(EXIT_FAILURE);
      };
      }
    }
    op_write1(str[i]);
  }
}


x86 assembly (clang, -O0):
<op_enc_db_ascii>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     120c <op_enc_db_ascii+0xcc>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    11ea <op_enc_db_ascii+0xaa>
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    0x1(%rax,%rcx,1),%al
sub    $0x30,%al
jne    11ba <op_enc_db_ascii+0x7a>
jmp    11a2 <op_enc_db_ascii+0x62>
xor    %edi,%edi
call   1050 <op_write1@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11fb <op_enc_db_ascii+0xbb>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
lea    0xe2e(%rip),%rsi
movsbl 0x1(%rax,%rcx,1),%edx
call   1040 <fprintf@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <op_write1@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1166 <op_enc_db_ascii+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_enc_db_ascii>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1030 <strlen@plt>
add    $0xffffffff,%eax
movslq %eax,%r14
xor    %ebx,%ebx
jmp    1171 <op_enc_db_ascii+0x31>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1050 <op_write1@plt>
add    $0x1,%rbx
cmp    %r14,%rbx
ja     118c <op_enc_db_ascii+0x4c>
movzbl (%r15,%rbx,1),%eax
cmp    $0x5c,%al
jne    1160 <op_enc_db_ascii+0x20>
movzbl 0x1(%r15,%rbx,1),%eax
cmp    $0x30,%al
jne    1192 <op_enc_db_ascii+0x52>
add    $0x1,%rbx
xor    %eax,%eax
jmp    1160 <op_enc_db_ascii+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e47(%rip),%rcx
mov    (%rcx),%edi
movsbl %al,%edx
lea    0xe5b(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"parse error: warning:ascii: unimplemented \\%c\0A\00"
@EXIT_FAILURE = global i32 0
define void @op_enc_db_ascii(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = sub nsw i32 %6, 1
%8 = sext i32 %7 to i64
store i64 %8, i64* %3
store i64 0, i64* %4
br label %9
9: ; preds = %47, %1
%10 = load i64, i64* %4
%11 = load i64, i64* %3
%12 = icmp ule i64 %10, %11
br i1 %12, label %13, label %50
13: ; preds = %9
%14 = load i8*, i8** %2
%15 = load i64, i64* %4
%16 = getelementptr inbounds i8, i8* %14, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 92
br i1 %19, label %20, label %41
20: ; preds = %13
%21 = load i8*, i8** %2
%22 = load i64, i64* %4
%23 = add i64 %22, 1
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
switch i32 %26, label %31 [
i32 48, label %27
]
27: ; preds = %20
%28 = call i32 @op_write1(i8 signext 0)
%29 = load i64, i64* %4
%30 = add i64 %29, 1
store i64 %30, i64* %4
br label %47
31: ; preds = %20
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %2
%34 = load i64, i64* %4
%35 = add i64 %34, 1
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8 signext %37)
%39 = load i32, i32* @EXIT_FAILURE
%40 = call i32 @exit(i32 %39)
unreachable
41: ; preds = %13
%42 = load i8*, i8** %2
%43 = load i64, i64* %4
%44 = getelementptr inbounds i8, i8* %42, i64 %43
%45 = load i8, i8* %44
%46 = call i32 @op_write1(i8 signext %45)
br label %47
47: ; preds = %41, %27
%48 = load i64, i64* %4
%49 = add i64 %48, 1
store i64 %49, i64* %4
br label %9
50: ; preds = %9
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"parse error: warning:ascii: unimplemented \\%c\0A\00"
@EXIT_FAILURE = global i32 0
define void @op_enc_db_ascii(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
br label %6
5: ; preds = %21
ret void
6: ; preds = %1, %21
%7 = phi i64 [ 0, %1 ], [ %25, %21 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 92
br i1 %10, label %11, label %21
11: ; preds = %6
%12 = add i64 %7, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 48
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8 signext %14)
%19 = load i32, i32* @EXIT_FAILURE
%20 = tail call i32 @exit(i32 %19)
unreachable
21: ; preds = %6, %11
%22 = phi i8 [ 0, %11 ], [ %9, %6 ]
%23 = phi i64 [ %12, %11 ], [ %7, %6 ]
%24 = tail call i32 @op_write1(i8 signext %22)
%25 = add i64 %23, 1
%26 = icmp ugt i64 %25, %4
br i1 %26, label %5, label %6
}