#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);
scalar_t__ error();
int lookup_set(char *);
int named_set(char *, int);
int /*<<< orphan*/ set_error1(char *);
int /*<<< orphan*/ set_error2(char *);
int /*<<< orphan*/ set_subtraction(int, int, int);
int /*<<< orphan*/ sprintf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
void handle_subtraction(char *setname1, char *setname2, char *setname3) {
  int set1, set2, set3;
  char message[255];
  if (strcmp(setname2, setname3) == 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_error1(message);
      return;
    }
  }
  if (strcmp(setname2, setname3) == 0) {
    clear_set(set1);
    return;
  }
  set2 = lookup_set(setname2);
  if (set2 == 0 || error()) {
    sprintf(message, "invalid setname(%s) in -", setname2);
    set_error2(message);
    return;
  }
  set3 = lookup_set(setname3);
  if (set3 == 0 || error()) {
    sprintf(message, "invalid setname(%s) in -", setname3);
    set_error2(message);
    return;
  }
  if (error()) {
    return;
  }
  set_subtraction(set2, set3, set1);
  if (error()) {
    sprintf(message, "problem with set subtraction");
    set_error2(message);
    return;
  }
}


x86 assembly (clang, -O0):
<handle_subtraction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11c3 <handle_subtraction+0x33>
jmp    134c <handle_subtraction+0x1bc>
mov    -0x8(%rbp),%rdi
call   1050 <lookup_set@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1230 <handle_subtraction+0xa0>
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
call   1060 <named_set@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1205 <handle_subtraction+0x75>
mov    $0x0,%al
call   10a0 <error@plt>
cmp    $0x0,%rax
je     122b <handle_subtraction+0x9b>
lea    -0x130(%rbp),%rdi
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x130(%rbp),%rdi
call   1090 <set_error1@plt>
jmp    134c <handle_subtraction+0x1bc>
jmp    1230 <handle_subtraction+0xa0>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1254 <handle_subtraction+0xc4>
mov    -0x1c(%rbp),%edi
call   1080 <clear_set@plt>
jmp    134c <handle_subtraction+0x1bc>
mov    -0x10(%rbp),%rdi
call   1050 <lookup_set@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     127b <handle_subtraction+0xeb>
mov    $0x0,%al
call   10a0 <error@plt>
cmp    $0x0,%rax
je     12a5 <handle_subtraction+0x115>
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xd8f(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x130(%rbp),%rdi
call   1040 <set_error2@plt>
jmp    134c <handle_subtraction+0x1bc>
mov    -0x18(%rbp),%rdi
call   1050 <lookup_set@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     12cc <handle_subtraction+0x13c>
mov    $0x0,%al
call   10a0 <error@plt>
cmp    $0x0,%rax
je     12f6 <handle_subtraction+0x166>
lea    -0x130(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd3e(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x130(%rbp),%rdi
call   1040 <set_error2@plt>
jmp    134c <handle_subtraction+0x1bc>
mov    $0x0,%al
call   10a0 <error@plt>
cmp    $0x0,%rax
je     130c <handle_subtraction+0x17c>
jmp    134c <handle_subtraction+0x1bc>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1030 <set_subtraction@plt>
mov    $0x0,%al
call   10a0 <error@plt>
cmp    $0x0,%rax
je     134c <handle_subtraction+0x1bc>
lea    -0x130(%rbp),%rdi
lea    0xcfc(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x130(%rbp),%rdi
call   1040 <set_error2@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_subtraction>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     125e <handle_subtraction+0xce>
mov    %rbx,%rdi
call   1050 <lookup_set@plt>
mov    %eax,%r14d
test   %eax,%eax
je     121f <handle_subtraction+0x8f>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     126e <handle_subtraction+0xde>
mov    %rbp,%rdi
call   1050 <lookup_set@plt>
test   %eax,%eax
je     11fe <handle_subtraction+0x6e>
mov    %eax,%r15d
xor    %eax,%eax
call   10a0 <error@plt>
test   %rax,%rax
je     1285 <handle_subtraction+0xf5>
lea    0xe17(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <set_error2@plt>
jmp    125e <handle_subtraction+0xce>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1060 <named_set@plt>
test   %eax,%eax
je     123f <handle_subtraction+0xaf>
mov    %eax,%r14d
xor    %eax,%eax
call   10a0 <error@plt>
test   %rax,%rax
je     11cb <handle_subtraction+0x3b>
movups 0xdc6(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movups 0xdae(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1090 <set_error1@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14d,%edi
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <clear_set@plt>
mov    %r12,%rdi
call   1050 <lookup_set@plt>
test   %eax,%eax
je     129f <handle_subtraction+0x10f>
mov    %eax,%ebp
xor    %eax,%eax
call   10a0 <error@plt>
test   %rax,%rax
je     12b4 <handle_subtraction+0x124>
lea    0xd76(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r12,%rdx
jmp    120e <handle_subtraction+0x7e>
xor    %eax,%eax
call   10a0 <error@plt>
test   %rax,%rax
jne    125e <handle_subtraction+0xce>
mov    %r15d,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <set_subtraction@plt>
xor    %eax,%eax
call   10a0 <error@plt>
test   %rax,%rax
je     125e <handle_subtraction+0xce>
movups 0xd62(%rip),%xmm0
movups %xmm0,0xd(%rsp)
movups 0xd49(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
jmp    1218 <handle_subtraction+0x88>

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 = [29 x i8] c"problem with set subtraction\00"
define void @handle_subtraction(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [255 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = call i64 @strcmp(i8* %11, i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %3
br label %87
16: ; preds = %3
%17 = load i8*, i8** %4
%18 = call i32 @lookup_set(i8* %17)
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %35
21: ; preds = %16
%22 = load i8*, i8** %4
%23 = call i32 @named_set(i8* %22, i32 6)
store i32 %23, i32* %7
%24 = load i32, i32* %7
%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_error1(i8* %32)
br label %87
34: ; preds = %26
br label %35
35: ; preds = %34, %16
%36 = load i8*, i8** %5
%37 = load i8*, i8** %6
%38 = call i64 @strcmp(i8* %36, i8* %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %35
%41 = load i32, i32* %7
%42 = call i32 @clear_set(i32 %41)
br label %87
43: ; preds = %35
%44 = load i8*, i8** %5
%45 = call i32 @lookup_set(i8* %44)
store i32 %45, i32* %8
%46 = load i32, i32* %8
%47 = icmp eq i32 %46, 0
br i1 %47, label %51, label %48
48: ; preds = %43
%49 = call i64 (...) @error()
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %57
51: ; preds = %48, %43
%52 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%53 = load i8*, i8** %5
%54 = call i32 (i8*, i8*, ...) @sprintf(i8* %52, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %53)
%55 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%56 = call i32 @set_error2(i8* %55)
br label %87
57: ; preds = %48
%58 = load i8*, i8** %6
%59 = call i32 @lookup_set(i8* %58)
store i32 %59, i32* %9
%60 = load i32, i32* %9
%61 = icmp eq i32 %60, 0
br i1 %61, label %65, label %62
62: ; preds = %57
%63 = call i64 (...) @error()
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %71
65: ; preds = %62, %57
%66 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%67 = load i8*, i8** %6
%68 = call i32 (i8*, i8*, ...) @sprintf(i8* %66, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %67)
%69 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%70 = call i32 @set_error2(i8* %69)
br label %87
71: ; preds = %62
%72 = call i64 (...) @error()
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %71
br label %87
75: ; preds = %71
%76 = load i32, i32* %8
%77 = load i32, i32* %9
%78 = load i32, i32* %7
%79 = call i32 @set_subtraction(i32 %76, i32 %77, i32 %78)
%80 = call i64 (...) @error()
%81 = icmp ne i64 %80, 0
br i1 %81, label %82, label %87
82: ; preds = %75
%83 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%84 = call i32 (i8*, i8*, ...) @sprintf(i8* %83, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%85 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%86 = call i32 @set_error2(i8* %85)
br label %87
87: ; preds = %15, %29, %40, %51, %65, %74, %82, %75
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 = [29 x i8] c"problem with set subtraction\00"
define void @handle_subtraction(i8* %0, i8* %1, i8* %2) {
%4 = alloca [255 x i8]
%5 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%6 = tail call i64 @strcmp(i8* %1, i8* %2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %52, label %8
8: ; preds = %3
%9 = tail call i32 @lookup_set(i8* %0)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = tail call i32 @named_set(i8* %0, i32 6)
%13 = icmp eq i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = tail call i64 (...) @error()
%16 = icmp eq i64 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %14, %11
%18 = call i32 @set_error1(i8* %5)
br label %52
19: ; preds = %14, %8
%20 = phi i32 [ %12, %14 ], [ %9, %8 ]
%21 = tail call i64 @strcmp(i8* %1, i8* %2)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = tail call i32 @clear_set(i32 %20)
br label %52
25: ; preds = %19
%26 = tail call i32 @lookup_set(i8* %1)
%27 = icmp eq i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = tail call i64 (...) @error()
%30 = icmp eq i64 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %28, %25
%32 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%33 = call i32 @set_error2(i8* %5)
br label %52
34: ; preds = %28
%35 = tail call i32 @lookup_set(i8* %2)
%36 = icmp eq i32 %35, 0
br i1 %36, label %40, label %37
37: ; preds = %34
%38 = tail call i64 (...) @error()
%39 = icmp eq i64 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %37, %34
%41 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%42 = call i32 @set_error2(i8* %5)
br label %52
43: ; preds = %37
%44 = tail call i64 (...) @error()
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %52
46: ; preds = %43
%47 = tail call i32 @set_subtraction(i32 %26, i32 %35, i32 %20)
%48 = tail call i64 (...) @error()
%49 = icmp eq i64 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %46
%51 = call i32 @set_error2(i8* %5)
br label %52
52: ; preds = %46, %43, %3, %50, %40, %31, %23, %17
ret void
}