#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*/ clear_set(int);
int count_set(int);
scalar_t__ error();
int /*<<< orphan*/ include_member(int, int, int);
int init_for(int);
int lookup_set(char *);
int named_set(char *, int);
int next_for(int);
int /*<<< orphan*/ set_error1(char *);
int /*<<< orphan*/ set_error2(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
void simple_set_copy(char *setname1, char *setname2) {
  int set1, set2, o;
  int count1, count2;
  char message[255];
  if (strcmp(setname1, setname2) == 0)
    return;
  set1 = lookup_set(setname1);
  if (set1 == 0) {
    set1 = named_set(setname1, 6);
    if (set1 == 0 || error()) {
      sprintf(message, "problem with set definition");
      set_error2(message);
      return;
    }
  } else
    clear_set(set1);
  set2 = lookup_set(setname2);
  if (set2 == 0 || error()) {
    set_error2(message);
    sprintf(message, "invalid setname(%s) in -", setname2);
    return;
  }
  count2 = count_set(set2);
  for (o = init_for(set2); o != 0; o = next_for(set2)) {
    include_member(set1, 6, o);
  }
  count1 = count_set(set1);
  if (count1 != count2) {
    sprintf(message, "simple_set_copy: inconsistent number of atoms in sets");
    set_error1(message);
  }
}


x86 assembly (clang, -O0):
<simple_set_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11ef <simple_set_copy+0x2f>
jmp    132d <simple_set_copy+0x16d>
mov    -0x8(%rbp),%rdi
call   1050 <lookup_set@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    125c <simple_set_copy+0x9c>
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
call   1060 <named_set@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1231 <simple_set_copy+0x71>
mov    $0x0,%al
call   10b0 <error@plt>
cmp    $0x0,%rax
je     1257 <simple_set_copy+0x97>
lea    -0x130(%rbp),%rdi
lea    0xdc1(%rip),%rsi
mov    $0x0,%al
call   10e0 <sprintf@plt>
lea    -0x130(%rbp),%rdi
call   1040 <set_error2@plt>
jmp    132d <simple_set_copy+0x16d>
jmp    1264 <simple_set_copy+0xa4>
mov    -0x14(%rbp),%edi
call   1080 <clear_set@plt>
mov    -0x10(%rbp),%rdi
call   1050 <lookup_set@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     128b <simple_set_copy+0xcb>
mov    $0x0,%al
call   10b0 <error@plt>
cmp    $0x0,%rax
je     12b5 <simple_set_copy+0xf5>
lea    -0x130(%rbp),%rdi
call   1040 <set_error2@plt>
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xd73(%rip),%rsi
mov    $0x0,%al
call   10e0 <sprintf@plt>
jmp    132d <simple_set_copy+0x16d>
mov    -0x18(%rbp),%edi
call   10d0 <count_set@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <init_for@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     12f5 <simple_set_copy+0x135>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%edx
mov    $0x6,%esi
call   1090 <include_member@plt>
mov    -0x18(%rbp),%edi
call   10c0 <next_for@plt>
mov    %eax,-0x1c(%rbp)
jmp    12cb <simple_set_copy+0x10b>
mov    -0x14(%rbp),%edi
call   10d0 <count_set@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
je     132d <simple_set_copy+0x16d>
lea    -0x130(%rbp),%rdi
lea    0xd1b(%rip),%rsi
mov    $0x0,%al
call   10e0 <sprintf@plt>
lea    -0x130(%rbp),%rdi
call   10a0 <set_error1@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_set_copy>:
push   %rbp
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%r14
mov    %rdi,%rbp
call   1070 <strcmp@plt>
test   %rax,%rax
je     12ef <simple_set_copy+0x12f>
mov    %rbp,%rdi
call   1050 <lookup_set@plt>
test   %eax,%eax
je     1232 <simple_set_copy+0x72>
mov    %eax,%ebx
mov    %eax,%edi
call   1080 <clear_set@plt>
mov    %r14,%rdi
call   1050 <lookup_set@plt>
test   %eax,%eax
je     120e <simple_set_copy+0x4e>
mov    %eax,%ebp
xor    %eax,%eax
call   10b0 <error@plt>
test   %rax,%rax
je     1272 <simple_set_copy+0xb2>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <set_error2@plt>
lea    0xdfc(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   10e0 <sprintf@plt>
jmp    12ef <simple_set_copy+0x12f>
mov    %rbp,%rdi
mov    $0x6,%esi
call   1060 <named_set@plt>
test   %eax,%eax
je     1251 <simple_set_copy+0x91>
mov    %eax,%ebx
xor    %eax,%eax
call   10b0 <error@plt>
test   %rax,%rax
je     11f4 <simple_set_copy+0x34>
movups 0xdb4(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movups 0xd9c(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <set_error2@plt>
jmp    12ef <simple_set_copy+0x12f>
mov    %ebp,%edi
call   10d0 <count_set@plt>
mov    %eax,%r14d
mov    %ebp,%edi
call   1030 <init_for@plt>
test   %eax,%eax
je     12a9 <simple_set_copy+0xe9>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    $0x6,%esi
mov    %eax,%edx
call   1090 <include_member@plt>
mov    %ebp,%edi
call   10c0 <next_for@plt>
test   %eax,%eax
jne    1290 <simple_set_copy+0xd0>
mov    %ebx,%edi
call   10d0 <count_set@plt>
cmp    %r14d,%eax
je     12ef <simple_set_copy+0x12f>
movups 0xd99(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xd7d(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xd61(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x73746573206e69,%rax
mov    %rax,0x2e(%rsp)
mov    %rsp,%rdi
call   10a0 <set_error1@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"problem with set definition\00"
@.str.1 = [25 x i8] c"invalid setname(%s) in -\00"
@.str.2 = [54 x i8] c"simple_set_copy: inconsistent number of atoms in sets\00"
define void @simple_set_copy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [255 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = call i64 @strcmp(i8* %11, i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %2
br label %78
16: ; preds = %2
%17 = load i8*, i8** %3
%18 = call i32 @lookup_set(i8* %17)
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %35
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = call i32 @named_set(i8* %22, i32 6)
store i32 %23, i32* %5
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %21
%27 = call i64 (...) @error()
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %26, %21
%30 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%31 = call i32 (i8*, i8*, ...) @sprintf(i8* %30, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%32 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%33 = call i32 @set_error2(i8* %32)
br label %78
34: ; preds = %26
br label %38
35: ; preds = %16
%36 = load i32, i32* %5
%37 = call i32 @clear_set(i32 %36)
br label %38
38: ; preds = %35, %34
%39 = load i8*, i8** %4
%40 = call i32 @lookup_set(i8* %39)
store i32 %40, i32* %6
%41 = load i32, i32* %6
%42 = icmp eq i32 %41, 0
br i1 %42, label %46, label %43
43: ; preds = %38
%44 = call i64 (...) @error()
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %52
46: ; preds = %43, %38
%47 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%48 = call i32 @set_error2(i8* %47)
%49 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%50 = load i8*, i8** %4
%51 = call i32 (i8*, i8*, ...) @sprintf(i8* %49, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %50)
br label %78
52: ; preds = %43
%53 = load i32, i32* %6
%54 = call i32 @count_set(i32 %53)
store i32 %54, i32* %9
%55 = load i32, i32* %6
%56 = call i32 @init_for(i32 %55)
store i32 %56, i32* %7
br label %57
57: ; preds = %64, %52
%58 = load i32, i32* %7
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %67
60: ; preds = %57
%61 = load i32, i32* %5
%62 = load i32, i32* %7
%63 = call i32 @include_member(i32 %61, i32 6, i32 %62)
br label %64
64: ; preds = %60
%65 = load i32, i32* %6
%66 = call i32 @next_for(i32 %65)
store i32 %66, i32* %7
br label %57
67: ; preds = %57
%68 = load i32, i32* %5
%69 = call i32 @count_set(i32 %68)
store i32 %69, i32* %8
%70 = load i32, i32* %8
%71 = load i32, i32* %9
%72 = icmp ne i32 %70, %71
br i1 %72, label %73, label %78
73: ; preds = %67
%74 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%75 = call i32 (i8*, i8*, ...) @sprintf(i8* %74, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
%76 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%77 = call i32 @set_error1(i8* %76)
br label %78
78: ; preds = %15, %29, %46, %73, %67
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"problem with set definition\00"
@.str.1 = [25 x i8] c"invalid setname(%s) in -\00"
@.str.2 = [54 x i8] c"simple_set_copy: inconsistent number of atoms in sets\00"
define void @simple_set_copy(i8* %0, i8* %1) {
%3 = alloca [255 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%5 = tail call i64 @strcmp(i8* %0, i8* %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %44, label %7
7: ; preds = %2
%8 = tail call i32 @lookup_set(i8* %0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = tail call i32 @named_set(i8* %0, i32 6)
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = tail call i64 (...) @error()
%15 = icmp eq i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %13, %10
%17 = call i32 @set_error2(i8* %4)
br label %44
18: ; preds = %7
%19 = tail call i32 @clear_set(i32 %8)
br label %20
20: ; preds = %13, %18
%21 = phi i32 [ %11, %13 ], [ %8, %18 ]
%22 = tail call i32 @lookup_set(i8* %1)
%23 = icmp eq i32 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %20
%25 = tail call i64 (...) @error()
%26 = icmp eq i64 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %24, %20
%28 = call i32 @set_error2(i8* %4)
%29 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %44
30: ; preds = %24
%31 = tail call i32 @count_set(i32 %22)
%32 = tail call i32 @init_for(i32 %22)
%33 = icmp eq i32 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %30, %34
%35 = phi i32 [ %37, %34 ], [ %32, %30 ]
%36 = tail call i32 @include_member(i32 %21, i32 6, i32 %35)
%37 = tail call i32 @next_for(i32 %22)
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %34
39: ; preds = %34, %30
%40 = tail call i32 @count_set(i32 %21)
%41 = icmp eq i32 %40, %31
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = call i32 @set_error1(i8* %4)
br label %44
44: ; preds = %39, %42, %2, %27, %16
ret void
}