#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*/ emit_label(char *);
int /*<<< orphan*/ emitf(int, char *, ...);
char *make_label();
char *quote_cstring(char *);
void emit_data_charptr(char *s, int depth) {
  char *label = make_label();
  emitf(1379,
        "\t"
        ".data %d",
        depth + 1);
  emit_label(label);
  emitf(1381,
        "\t"
        ".string \"%s\"",
        quote_cstring(s));
  emitf(1382,
        "\t"
        ".data %d",
        depth);
  emitf(1383,
        "\t"
        ".quad %s",
        label);
}


x86 assembly (clang, -O0):
<emit_data_charptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <make_label@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edx
add    $0x1,%edx
mov    $0x563,%edi
lea    0xe94(%rip),%rsi
mov    $0x0,%al
call   1050 <emitf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <emit_label@plt>
mov    -0x8(%rbp),%rdi
call   1040 <quote_cstring@plt>
mov    %rax,%rdx
mov    $0x565,%edi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1050 <emitf@plt>
mov    -0xc(%rbp),%edx
mov    $0x566,%edi
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1050 <emitf@plt>
mov    -0x18(%rbp),%rdx
mov    $0x567,%edi
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1050 <emitf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_data_charptr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r15
xor    %eax,%eax
call   1030 <make_label@plt>
mov    %rax,%rbx
lea    0x1(%r14),%edx
lea    0xe9d(%rip),%r12
mov    $0x563,%edi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <emitf@plt>
mov    %rbx,%rdi
call   1060 <emit_label@plt>
mov    %r15,%rdi
call   1040 <quote_cstring@plt>
lea    0xe81(%rip),%rsi
mov    $0x565,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <emitf@plt>
mov    $0x566,%edi
mov    %r12,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <emitf@plt>
lea    0xe67(%rip),%rsi
mov    $0x567,%edi
mov    %rbx,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <emitf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"\09.data %d\00"
@.str.1 = [14 x i8] c"\09.string \22%s\22\00"
@.str.2 = [10 x i8] c"\09.quad %s\00"
define void @emit_data_charptr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i8* (...) @make_label()
store i8* %6, i8** %5
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
%9 = call i32 (i32, i8*, ...) @emitf(i32 1379, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i8*, i8** %5
%11 = call i32 @emit_label(i8* %10)
%12 = load i8*, i8** %3
%13 = call i8* @quote_cstring(i8* %12)
%14 = call i32 (i32, i8*, ...) @emitf(i32 1381, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = load i32, i32* %4
%16 = call i32 (i32, i8*, ...) @emitf(i32 1382, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i8*, i8** %5
%18 = call i32 (i32, i8*, ...) @emitf(i32 1383, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %17)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"\09.data %d\00"
@.str.1 = [14 x i8] c"\09.string \22%s\22\00"
@.str.2 = [10 x i8] c"\09.quad %s\00"
define void @emit_data_charptr(i8* %0, i32 %1) {
%3 = tail call i8* (...) @make_label()
%4 = add nsw i32 %1, 1
%5 = tail call i32 (i32, i8*, ...) @emitf(i32 1379, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 @emit_label(i8* %3)
%7 = tail call i8* @quote_cstring(i8* %0)
%8 = tail call i32 (i32, i8*, ...) @emitf(i32 1381, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = tail call i32 (i32, i8*, ...) @emitf(i32 1382, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%10 = tail call i32 (i32, i8*, ...) @emitf(i32 1383, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %3)
ret void
}