#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 Server {
  int dummy;
};
struct Class {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ClearClasses();
int /*<<< orphan*/ DeleteClass(struct Class *);
struct Class *FindClass(int /*<<< orphan*/);
int /*<<< orphan*/ atoi(char *);
void c_class_clear(struct Server *sptr, int ac, char **av) {
  struct Class *clptr;
  if (ac >= 3) {
    if ((clptr = FindClass(atoi(av[2]))))
      DeleteClass(clptr);
  } else
    ClearClasses();
}


x86 assembly (clang, -O0):
<c_class_clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x3,-0xc(%rbp)
jl     118d <c_class_clear+0x4d>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <FindClass@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1188 <c_class_clear+0x48>
mov    -0x20(%rbp),%rdi
call   1040 <DeleteClass@plt>
jmp    1194 <c_class_clear+0x54>
mov    $0x0,%al
call   1030 <ClearClasses@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_class_clear>:
cmp    $0x3,%esi
jl     1168 <c_class_clear+0x28>
push   %rax
mov    0x10(%rdx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <FindClass@plt>
test   %rax,%rax
lea    0x8(%rsp),%rsp
je     116f <c_class_clear+0x2f>
mov    %rax,%rdi
jmp    1040 <DeleteClass@plt>
xor    %eax,%eax
jmp    1030 <ClearClasses@plt>
ret

LLVM IR (-O0):
%struct.Server = type { i32 }
%struct.Class = type { i32 }
define void @c_class_clear(%struct.Server* %0, i32 %1, i8** %2) {
%4 = alloca %struct.Server*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca %struct.Class*
store %struct.Server* %0, %struct.Server** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%8 = load i32, i32* %5
%9 = icmp sge i32 %8, 3
br i1 %9, label %10, label %21
10: ; preds = %3
%11 = load i8**, i8*** %6
%12 = getelementptr inbounds i8*, i8** %11, i64 2
%13 = load i8*, i8** %12
%14 = call i32 @atoi(i8* %13)
%15 = call %struct.Class* @FindClass(i32 %14)
store %struct.Class* %15, %struct.Class** %7
%16 = icmp ne %struct.Class* %15, null
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = load %struct.Class*, %struct.Class** %7
%19 = call i32 @DeleteClass(%struct.Class* %18)
br label %20
20: ; preds = %17, %10
br label %23
21: ; preds = %3
%22 = call i32 (...) @ClearClasses()
br label %23
23: ; preds = %21, %20
ret void
}

LLVM IR (-O2):
%struct.Server = type { i32 }
%struct.Class = type { i32 }
define void @c_class_clear(%struct.Server* nocapture readnone %0, i32 %1, i8** nocapture %2) {
%4 = icmp sgt i32 %1, 2
br i1 %4, label %5, label %13
5: ; preds = %3
%6 = getelementptr inbounds i8*, i8** %2, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = tail call %struct.Class* @FindClass(i32 %8)
%10 = icmp eq %struct.Class* %9, null
br i1 %10, label %15, label %11
11: ; preds = %5
%12 = tail call i32 @DeleteClass(%struct.Class* %9)
br label %15
13: ; preds = %3
%14 = tail call i32 (...) @ClearClasses()
br label %15
15: ; preds = %5, %11, %13
ret void
}