#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 */
char lirc_parse_escape(char **, int);
void lirc_parse_string(char *s, int line) {
  char *t;
  t = s;
  while (*s != 0) {
    if (*s == '\\') {
      s++;
      *t = lirc_parse_escape(&s, line);
      t++;
    } else {
      *t = *s;
      s++;
      t++;
    }
  }
  *t = 0;
}


x86 assembly (clang, -O0):
<lirc_parse_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11a1 <lirc_parse_string+0x91>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1178 <lirc_parse_string+0x68>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    -0x8(%rbp),%rdi
call   1030 <lirc_parse_escape@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    119c <lirc_parse_string+0x8c>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1127 <lirc_parse_string+0x17>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lirc_parse_string>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%r14
mov    %rdi,%rbx
jmp    114e <lirc_parse_string+0x3e>
nopl   0x0(%rax)
add    $0x1,%rdi
mov    %rdi,0x8(%rsp)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <lirc_parse_escape@plt>
mov    %al,(%rbx)
mov    0x8(%rsp),%rdi
add    $0x1,%rbx
movzbl (%rdi),%eax
cmp    $0x5c,%al
je     1130 <lirc_parse_string+0x20>
test   %al,%al
je     116a <lirc_parse_string+0x5a>
mov    %al,(%rbx)
add    $0x1,%rdi
mov    %rdi,0x8(%rsp)
add    $0x1,%rbx
jmp    114e <lirc_parse_string+0x3e>
movb   $0x0,(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @lirc_parse_string(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %33, %2
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %34
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 92
br i1 %16, label %17, label %25
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
%20 = load i32, i32* %4
%21 = call signext i8 @lirc_parse_escape(i8** %3, i32 %20)
%22 = load i8*, i8** %5
store i8 %21, i8* %22
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %5
br label %33
25: ; preds = %12
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = load i8*, i8** %5
store i8 %27, i8* %28
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %5
br label %33
33: ; preds = %25, %17
br label %7
34: ; preds = %7
%35 = load i8*, i8** %5
store i8 0, i8* %35
ret void
}

LLVM IR (-O2):
define void @lirc_parse_string(i8* %0, i32 %1) {
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %14, %2
%5 = phi i8* [ %0, %2 ], [ %15, %14 ]
%6 = phi i8* [ %0, %2 ], [ %16, %14 ]
%7 = load i8, i8* %5
switch i8 %7, label %12 [
i8 0, label %17
i8 92, label %8
]
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %9, i8** %3
%10 = call signext i8 @lirc_parse_escape(i8** %3, i32 %1)
store i8 %10, i8* %6
%11 = load i8*, i8** %3
br label %14
12: ; preds = %4
store i8 %7, i8* %6
%13 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %13, i8** %3
br label %14
14: ; preds = %12, %8
%15 = phi i8* [ %13, %12 ], [ %11, %8 ]
%16 = getelementptr inbounds i8, i8* %6, i64 1
br label %4
17: ; preds = %4
store i8 0, i8* %6
ret void
}