#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 */
struct opctx {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ output_dump_stack(struct opctx *);
int /*<<< orphan*/ outputf(struct opctx *, char *, ...);
int output_populate_ro_property(struct opctx *outc, const char *class_name,
                                const char *property) {
  outputf(outc, "\t/* Add readonly property */\n");
  outputf(outc, "\tduk_dup(ctx, 0);\n");
  outputf(outc, "\tduk_push_string(ctx, \"%s\");\n", property);
  outputf(outc, "\tduk_push_c_function(ctx, %s_%s_%s_getter, 0);\n", "dukky",
          class_name, property);
  output_dump_stack(outc);
  outputf(outc, "\tduk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER |\n");
  outputf(outc, "\t\tDUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_ENUMERABLE |\n");
  outputf(outc, "\t\tDUK_DEFPROP_HAVE_CONFIGURABLE);\n");
  outputf(outc, "\tduk_pop(ctx);\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<output_populate_ro_property>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec1(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xece(%rip),%rsi
lea    0xef7(%rip),%rdx
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <output_dump_stack@plt>
mov    -0x8(%rbp),%rdi
lea    0xee2(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf02(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf2a(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf3b(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_populate_ro_property>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xecb(%rip),%rsi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xedb(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xedd(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xee7(%rip),%rsi
lea    0xf10(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1040 <outputf@plt>
mov    %rbx,%rdi
call   1030 <output_dump_stack@plt>
lea    0xef7(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xf18(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xf41(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xf53(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.opctx = type { i32 }
@.str = [30 x i8] c"\09/* Add property */\0A\00"
@.str.1 = [19 x i8] c"\09duk_dup(ctx, 0);\0A\00"
@.str.2 = [30 x i8] c"\09duk_push_string(ctx, \22%s\22);\0A\00"
@.str.3 = [48 x i8] c"\09duk_push_c_function(ctx, %s_%s_%s_getter, 0);\0A\00"
@.str.4 = [6 x i8] c"dukky\00"
@.str.5 = [50 x i8] c"\09duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER |\0A\00"
@.str.6 = [58 x i8] c"\09\09DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_ENUMERABLE |\0A\00"
@.str.7 = [35 x i8] c"\09\09DUK_DEFPROP_HAVE_CONFIGURABLE);\0A\00"
@.str.8 = [17 x i8] c"\09duk_pop(ctx);\0A\0A\00"
define i32 @output_populate_ro_property(%struct.opctx* %0, i8* %1, i8* %2) {
%4 = alloca %struct.opctx*
%5 = alloca i8*
%6 = alloca i8*
store %struct.opctx* %0, %struct.opctx** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load %struct.opctx*, %struct.opctx** %4
%8 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %7, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%9 = load %struct.opctx*, %struct.opctx** %4
%10 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%11 = load %struct.opctx*, %struct.opctx** %4
%12 = load i8*, i8** %6
%13 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %11, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = load %struct.opctx*, %struct.opctx** %4
%15 = load i8*, i8** %5
%16 = load i8*, i8** %6
%17 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %14, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %15, i8* %16)
%18 = load %struct.opctx*, %struct.opctx** %4
%19 = call i32 @output_dump_stack(%struct.opctx* %18)
%20 = load %struct.opctx*, %struct.opctx** %4
%21 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %20, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%22 = load %struct.opctx*, %struct.opctx** %4
%23 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %22, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.6, i64 0, i64 0))
%24 = load %struct.opctx*, %struct.opctx** %4
%25 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %24, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
%26 = load %struct.opctx*, %struct.opctx** %4
%27 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %26, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.opctx = type { i32 }
@.str = [30 x i8] c"\09/* Add property */\0A\00"
@.str.1 = [19 x i8] c"\09duk_dup(ctx, 0);\0A\00"
@.str.2 = [30 x i8] c"\09duk_push_string(ctx, \22%s\22);\0A\00"
@.str.3 = [48 x i8] c"\09duk_push_c_function(ctx, %s_%s_%s_getter, 0);\0A\00"
@.str.4 = [6 x i8] c"dukky\00"
@.str.5 = [50 x i8] c"\09duk_def_prop(ctx, -3, DUK_DEFPROP_HAVE_GETTER |\0A\00"
@.str.6 = [58 x i8] c"\09\09DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_ENUMERABLE |\0A\00"
@.str.7 = [35 x i8] c"\09\09DUK_DEFPROP_HAVE_CONFIGURABLE);\0A\00"
@.str.8 = [17 x i8] c"\09duk_pop(ctx);\0A\0A\00"
define i32 @output_populate_ro_property(%struct.opctx* %0, i8* %1, i8* %2) {
%4 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%7 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* %2)
%8 = tail call i32 @output_dump_stack(%struct.opctx* %0)
%9 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0))
%10 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}