#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 object {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int, int);
int /*<<< orphan*/ stderr;
int z_length(struct object *);
void z_assert_arity(const char *func, struct object *args, int arity) {
  if (z_length(args) != arity) {
    fprintf(
        stderr,
        "zymogen runtime error: function %s expected %d arguments, got %d\n",
        func, arity, z_length(args));
    exit(1);
  }
}


x86 assembly (clang, -O0):
<z_assert_arity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <z_length@plt>
cmp    -0x14(%rbp),%eax
je     119b <z_assert_arity+0x6b>
mov    0x2e84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <z_length@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    %eax,%r8d
lea    0xe74(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<z_assert_arity>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <z_length@plt>
cmp    %ebp,%eax
jne    1156 <z_assert_arity+0x26>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2e83(%rip),%rax
mov    (%rax),%r15d
mov    %rbx,%rdi
call   1040 <z_length@plt>
lea    0xe91(%rip),%rsi
mov    %r15d,%edi
mov    %r14,%rdx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.object = type { i32 }
@stderr = global i32 0
@.str = [66 x i8] c"zymogen runtime error: function %s expected %d arguments, got %d\0A\00"
define void @z_assert_arity(i8* %0, %struct.object* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca %struct.object*
%6 = alloca i32
store i8* %0, i8** %4
store %struct.object* %1, %struct.object** %5
store i32 %2, i32* %6
%7 = load %struct.object*, %struct.object** %5
%8 = call i32 @z_length(%struct.object* %7)
%9 = load i32, i32* %6
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %3
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %4
%14 = load i32, i32* %6
%15 = load %struct.object*, %struct.object** %5
%16 = call i32 @z_length(%struct.object* %15)
%17 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14, i32 %16)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %3
ret void
}

LLVM IR (-O2):
%struct.object = type { i32 }
@stderr = global i32 0
@.str = [66 x i8] c"zymogen runtime error: function %s expected %d arguments, got %d\0A\00"
define void @z_assert_arity(i8* %0, %struct.object* %1, i32 %2) {
%4 = tail call i32 @z_length(%struct.object* %1)
%5 = icmp eq i32 %4, %2
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @z_length(%struct.object* %1)
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %2, i32 %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %3
ret void
}