#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*/ outputf(struct opctx *, char *, ...);
int output_create_private(struct opctx *outc, char *class_name) {
  outputf(outc, "\t/* create private data and attach to instance */\n");
  outputf(outc, "\t%s_private_t *priv = calloc(1, sizeof(*priv));\n",
          class_name);
  outputf(outc, "\tif (priv == NULL) return 0;\n");
  outputf(outc, "\tduk_push_pointer(ctx, priv);\n");
  outputf(outc, "\tduk_put_prop_string(ctx, 0, %s_magic_string_private);\n\n",
          "dukky");
  return 0;
}


x86 assembly (clang, -O0):
<output_create_private>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0x0,%al
call   1030 <outputf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xef2(%rip),%rsi
mov    $0x0,%al
call   1030 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf11(%rip),%rsi
mov    $0x0,%al
call   1030 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf1d(%rip),%rsi
mov    $0x0,%al
call   1030 <outputf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf2a(%rip),%rsi
lea    0xf5c(%rip),%rdx
mov    $0x0,%al
call   1030 <outputf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_create_private>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rsi
xor    %eax,%eax
call   1030 <outputf@plt>
lea    0xf04(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <outputf@plt>
lea    0xf21(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <outputf@plt>
lea    0xf2e(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <outputf@plt>
lea    0xf3c(%rip),%rsi
lea    0xf6e(%rip),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <outputf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.opctx = type { i32 }
@.str = [51 x i8] c"\09/* create private data and attach to instance */\0A\00"
@.str.1 = [49 x i8] c"\09%s_private_t *priv = calloc(1, sizeof(*priv));\0A\00"
@.str.2 = [30 x i8] c"\09if (priv == NULL) return 0;\0A\00"
@.str.3 = [31 x i8] c"\09duk_push_pointer(ctx, priv);\0A\00"
@.str.4 = [57 x i8] c"\09duk_put_prop_string(ctx, 0, %s_magic_string_private);\0A\0A\00"
@.str.5 = [6 x i8] c"dukky\00"
define i32 @output_create_private(%struct.opctx* %0, i8* %1) {
%3 = alloca %struct.opctx*
%4 = alloca i8*
store %struct.opctx* %0, %struct.opctx** %3
store i8* %1, i8** %4
%5 = load %struct.opctx*, %struct.opctx** %3
%6 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %5, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%7 = load %struct.opctx*, %struct.opctx** %3
%8 = load i8*, i8** %4
%9 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %7, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load %struct.opctx*, %struct.opctx** %3
%11 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %10, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%12 = load %struct.opctx*, %struct.opctx** %3
%13 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %12, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%14 = load %struct.opctx*, %struct.opctx** %3
%15 = call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %14, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.opctx = type { i32 }
@.str = [51 x i8] c"\09/* create private data and attach to instance */\0A\00"
@.str.1 = [49 x i8] c"\09%s_private_t *priv = calloc(1, sizeof(*priv));\0A\00"
@.str.2 = [30 x i8] c"\09if (priv == NULL) return 0;\0A\00"
@.str.3 = [31 x i8] c"\09duk_push_pointer(ctx, priv);\0A\00"
@.str.4 = [57 x i8] c"\09duk_put_prop_string(ctx, 0, %s_magic_string_private);\0A\0A\00"
@.str.5 = [6 x i8] c"dukky\00"
define i32 @output_create_private(%struct.opctx* %0, i8* %1) {
%3 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = 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))
%6 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 (%struct.opctx*, i8*, ...) @outputf(%struct.opctx* %0, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}