#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 allocate_named(int, int);
scalar_t__ error();
int new_object_symbol(char *, int);
int /*<<< orphan*/ set_set_type(int, int);
int named_set(char *setname, int type) {
  int symbol_number;
  int object_number;
  symbol_number = new_object_symbol(setname, 46);
  if (error())
    return (0);
  object_number = allocate_named(46, symbol_number);
  if (object_number == 0)
    return (0);
  set_set_type(object_number, type);
  return (object_number);
}


x86 assembly (clang, -O0):
<named_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <new_object_symbol@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1060 <error@plt>
cmp    $0x0,%rax
je     117d <named_set+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <named_set+0x74>
mov    -0x18(%rbp),%esi
mov    $0x2e,%edi
call   1050 <allocate_named@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11a3 <named_set+0x63>
movl   $0x0,-0x4(%rbp)
jmp    11b4 <named_set+0x74>
mov    -0x1c(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <set_set_type@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<named_set>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    $0x2e,%esi
call   1040 <new_object_symbol@plt>
mov    %eax,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <error@plt>
test   %rax,%rax
jne    117f <named_set+0x3f>
mov    $0x2e,%edi
mov    %ebx,%esi
call   1050 <allocate_named@plt>
test   %eax,%eax
je     117f <named_set+0x3f>
mov    %eax,%ebx
mov    %eax,%edi
mov    %r14d,%esi
call   1030 <set_set_type@plt>
mov    %ebx,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @named_set(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = load i8*, i8** %4
%9 = call i32 @new_object_symbol(i8* %8, i32 46)
store i32 %9, i32* %6
%10 = call i64 (...) @error()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %24
13: ; preds = %2
%14 = load i32, i32* %6
%15 = call i32 @allocate_named(i32 46, i32 %14)
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 0, i32* %3
br label %24
19: ; preds = %13
%20 = load i32, i32* %7
%21 = load i32, i32* %5
%22 = call i32 @set_set_type(i32 %20, i32 %21)
%23 = load i32, i32* %7
store i32 %23, i32* %3
br label %24
24: ; preds = %19, %18, %12
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @named_set(i8* %0, i32 %1) {
%3 = tail call i32 @new_object_symbol(i8* %0, i32 46)
%4 = tail call i64 (...) @error()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = tail call i32 @allocate_named(i32 46, i32 %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @set_set_type(i32 %7, i32 %1)
br label %11
11: ; preds = %6, %2, %9
%12 = phi i32 [ %7, %9 ], [ 0, %2 ], [ 0, %6 ]
ret i32 %12
}