#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*/ printf(char *);
int /*<<< orphan*/ putchar(char);
void bee_getopt_print_quoted(char *s) {
  putchar('\'');
  while (*s) {
    if (*s == '\'')
      printf("'\\''");
    else
      putchar(*s);
    s++;
  }
  putchar('\'');
}


x86 assembly (clang, -O0):
<bee_getopt_print_quoted>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x27,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1181 <bee_getopt_print_quoted+0x61>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    1164 <bee_getopt_print_quoted+0x44>
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
jmp    1170 <bee_getopt_print_quoted+0x50>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1136 <bee_getopt_print_quoted+0x16>
mov    $0x27,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bee_getopt_print_quoted>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x27,%edi
call   1030 <putchar@plt>
lea    0xec8(%rip),%r14
jmp    114c <bee_getopt_print_quoted+0x2c>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x27,%al
je     1140 <bee_getopt_print_quoted+0x20>
test   %al,%al
je     1165 <bee_getopt_print_quoted+0x45>
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
jmp    114c <bee_getopt_print_quoted+0x2c>
mov    $0x27,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"'\\''\00"
define void @bee_getopt_print_quoted(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @putchar(i8 signext 39)
br label %4
4: ; preds = %19, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %4
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 39
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %19
15: ; preds = %8
%16 = load i8*, i8** %2
%17 = load i8, i8* %16
%18 = call i32 @putchar(i8 signext %17)
br label %19
19: ; preds = %15, %13
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %2
br label %4
22: ; preds = %4
%23 = call i32 @putchar(i8 signext 39)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"'\\''\00"
define void @bee_getopt_print_quoted(i8* nocapture %0) {
%2 = tail call i32 @putchar(i8 signext 39)
br label %3
3: ; preds = %10, %1
%4 = phi i8* [ %0, %1 ], [ %11, %10 ]
%5 = load i8, i8* %4
switch i8 %5, label %8 [
i8 0, label %12
i8 39, label %6
]
6: ; preds = %3
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %3
%9 = tail call i32 @putchar(i8 signext %5)
br label %10
10: ; preds = %8, %6
%11 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
12: ; preds = %3
%13 = tail call i32 @putchar(i8 signext 39)
ret void
}