#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_rw_property(struct opctx *outc, const char *class_name,
                                const char *property) {
  outputf(outc, "\t/* Add read/write 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);
  outputf(outc, "\tduk_push_c_function(ctx, %s_%s_%s_setter, 1);\n", "dukky",
          class_name, property);
  output_dump_stack(outc);
  outputf(outc, "\tduk_def_prop(ctx, -4, DUK_DEFPROP_HAVE_GETTER |\n");
  outputf(outc, "\t\tDUK_DEFPROP_HAVE_SETTER |\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_rw_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    0xecf(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xecc(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xed0(%rip),%rsi
lea    0xef9(%rip),%rdx
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xee5(%rip),%rsi
lea    0xed8(%rip),%rdx
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <output_dump_stack@plt>
mov    -0x8(%rbp),%rdi
lea    0xef3(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf13(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf1e(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf46(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf57(%rip),%rsi
mov    $0x0,%al
call   1040 <outputf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_populate_rw_property>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xeda(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xedc(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xee6(%rip),%rsi
lea    0xf0f(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xefb(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1040 <outputf@plt>
mov    %rbx,%rdi
call   1030 <output_dump_stack@plt>
lea    0xf09(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xf2a(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xf36(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xf5f(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
lea    0xf71(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <outputf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.opctx = type { i32 }
@.str = [32 x i8] c"\09/* Add read/write 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 = [48 x i8] c"\09duk_push_c_function(ctx, %s_%s_%s_setter, 1);\0A\00"
@.str.6 = [50 x i8] c"\09duk_def_prop(ctx, -4, DUK_DEFPROP_HAVE_GETTER |\0A\00"
@.str.7 = [29 x i8] c"\09\09DUK_DEFPROP_HAVE_SETTER |\0A\00"
@.str.8 = [58 x i8] c"\09\09DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_ENUMERABLE |\0A\00"
@.str.9 = [35 x i8] c"\09\09DUK_DEFPROP_HAVE_CONFIGURABLE);\0A\00"
@.str.10 = [17 x i8] c"\09duk_pop(ctx);\0A\0A\00"
define i32 @output_populate_rw_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 ([32 x i8], [32 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 = load i8*, i8** %5
%20 = load i8*, i8** %6
%21 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %18, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %19, i8* %20)
%22 = load %struct.opctx*, %struct.opctx** %4
%23 = call i32 @output_dump_stack(%struct.opctx* %22)
%24 = load %struct.opctx*, %struct.opctx** %4
%25 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %24, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%26 = load %struct.opctx*, %struct.opctx** %4
%27 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %26, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%28 = load %struct.opctx*, %struct.opctx** %4
%29 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %28, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.8, i64 0, i64 0))
%30 = load %struct.opctx*, %struct.opctx** %4
%31 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %30, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%32 = load %struct.opctx*, %struct.opctx** %4
%33 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.opctx = type { i32 }
@.str = [32 x i8] c"\09/* Add read/write 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 = [48 x i8] c"\09duk_push_c_function(ctx, %s_%s_%s_setter, 1);\0A\00"
@.str.6 = [50 x i8] c"\09duk_def_prop(ctx, -4, DUK_DEFPROP_HAVE_GETTER |\0A\00"
@.str.7 = [29 x i8] c"\09\09DUK_DEFPROP_HAVE_SETTER |\0A\00"
@.str.8 = [58 x i8] c"\09\09DUK_DEFPROP_HAVE_ENUMERABLE | DUK_DEFPROP_ENUMERABLE |\0A\00"
@.str.9 = [35 x i8] c"\09\09DUK_DEFPROP_HAVE_CONFIGURABLE);\0A\00"
@.str.10 = [17 x i8] c"\09duk_pop(ctx);\0A\0A\00"
define i32 @output_populate_rw_property(%struct.opctx* %0, i8* %1, i8* %2) {
%4 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([32 x i8], [32 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 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* %2)
%9 = tail call i32 @output_dump_stack(%struct.opctx* %0)
%10 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%11 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.8, i64 0, i64 0))
%13 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%14 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}