#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*/ gol_set_rules(int *, int *);
int *malloc(int);
int /*<<< orphan*/ memcpy(int *, int *, int);
void gol_set_default_rules() {
  int live[] = {2, 3, -1};
  int spawn[] = {3, -1};
  int *plive, *pspawn;
  plive = malloc(sizeof(int) * 3);
  pspawn = malloc(sizeof(int) * 2);
  memcpy(plive, live, sizeof(int) * 3);
  memcpy(pspawn, spawn, sizeof(int) * 2);
  gol_set_rules(plive, pspawn);
}


x86 assembly (clang, -O0):
<gol_set_default_rules>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0xc(%rbp)
mov    0xebf(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xeb9(%rip),%rax
mov    %rax,-0x14(%rbp)
mov    $0xc,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0xc,%edx
call   1040 <memcpy@plt>
mov    -0x28(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <gol_set_rules@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gol_set_default_rules>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0xecb(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xeb8(%rip),%rax
mov    %rax,0x8(%rsp)
movabs $0xffffffff00000003,%rax
ff ff ff
mov    %rax,(%rsp)
mov    $0xc,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
mov    $0xc,%edx
call   1040 <memcpy@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1040 <memcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <gol_set_rules@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.gol_set_default_rules.live = [3 x i32] [i32 2, i32 3, i32 -1]
@__const.gol_set_default_rules.spawn = [2 x i32] [i32 3, i32 -1]
define void @gol_set_default_rules() {
%1 = alloca [3 x i32]
%2 = alloca [2 x i32]
%3 = alloca i32*
%4 = alloca i32*
%5 = bitcast [3 x i32]* %1 to i8*
%6 = bitcast [2 x i32]* %2 to i8*
%7 = call i32* @malloc(i32 12)
store i32* %7, i32** %3
%8 = call i32* @malloc(i32 8)
store i32* %8, i32** %4
%9 = load i32*, i32** %3
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%11 = call i32 @memcpy(i32* %9, i32* %10, i32 12)
%12 = load i32*, i32** %4
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%14 = call i32 @memcpy(i32* %12, i32* %13, i32 8)
%15 = load i32*, i32** %3
%16 = load i32*, i32** %4
%17 = call i32 @gol_set_rules(i32* %15, i32* %16)
ret void
}

LLVM IR (-O2):
@__const.gol_set_default_rules.live = [3 x i32] [i32 2, i32 3, i32 -1]
define void @gol_set_default_rules() {
%1 = alloca [3 x i32]
%2 = alloca i64
%3 = bitcast [3 x i32]* %1 to i8*
%4 = bitcast i64* %2 to i8*
store i64 -4294967293, i64* %2
%5 = tail call i32* @malloc(i32 12)
%6 = tail call i32* @malloc(i32 8)
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%8 = call i32 @memcpy(i32* %5, i32* %7, i32 12)
%9 = bitcast i64* %2 to i32*
%10 = call i32 @memcpy(i32* %6, i32* %9, i32 8)
%11 = call i32 @gol_set_rules(i32* %5, i32* %6)
ret void
}