#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 _assert_int_mismatch(char *, int, int);
int _assert_null_found(char *);
int _assert_ok(char *);
int assert_equal_int(void *elem, int expected) {
  int *e;
  char func[] = "assert_equal_int";
  if (elem) {
    e = (int *)elem;
    if (expected == *e)
      return _assert_ok(func);
    else
      return _assert_int_mismatch(func, expected, *e);
  } else {
    return _assert_null_found(func);
  }
}


x86 assembly (clang, -O0):
<assert_equal_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeb5(%rip),%al
mov    %al,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11ab <assert_equal_int+0x7b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jne    1191 <assert_equal_int+0x61>
lea    -0x40(%rbp),%rdi
call   1040 <_assert_ok@plt>
mov    %eax,-0x4(%rbp)
jmp    11b7 <assert_equal_int+0x87>
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
call   1050 <_assert_int_mismatch@plt>
mov    %eax,-0x4(%rbp)
jmp    11b7 <assert_equal_int+0x87>
lea    -0x40(%rbp),%rdi
call   1030 <_assert_null_found@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_equal_int>:
sub    $0x18,%rsp
movaps 0xec5(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
test   %rdi,%rdi
je     115c <assert_equal_int+0x2c>
mov    (%rdi),%edx
mov    %rsp,%rdi
cmp    %esi,%edx
jne    1169 <assert_equal_int+0x39>
call   1040 <_assert_ok@plt>
add    $0x18,%rsp
ret
mov    %rsp,%rdi
call   1030 <_assert_null_found@plt>
add    $0x18,%rsp
ret
call   1050 <_assert_int_mismatch@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.assert_equal_int.func = [17 x i8] c"assert_equal_int\00"
define i32 @assert_equal_int(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca [17 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = bitcast [17 x i8]* %7 to i8*
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %27
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = bitcast i8* %12 to i32*
store i32* %13, i32** %6
%14 = load i32, i32* %5
%15 = load i32*, i32** %6
%16 = load i32, i32* %15
%17 = icmp eq i32 %14, %16
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%20 = call i32 @_assert_ok(i8* %19)
store i32 %20, i32* %3
br label %30
21: ; preds = %11
%22 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%23 = load i32, i32* %5
%24 = load i32*, i32** %6
%25 = load i32, i32* %24
%26 = call i32 @_assert_int_mismatch(i8* %22, i32 %23, i32 %25)
store i32 %26, i32* %3
br label %30
27: ; preds = %2
%28 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%29 = call i32 @_assert_null_found(i8* %28)
store i32 %29, i32* %3
br label %30
30: ; preds = %27, %21, %18
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@__const.assert_equal_int.func = [17 x i8] c"assert_equal_int\00"
define i32 @assert_equal_int(i8* %0, i32 %1) {
%3 = alloca [17 x i8]
%4 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%5 = icmp eq i8* %0, null
br i1 %5, label %14, label %6
6: ; preds = %2
%7 = bitcast i8* %0 to i32*
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, %1
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = call i32 @_assert_ok(i8* %4)
br label %16
12: ; preds = %6
%13 = call i32 @_assert_int_mismatch(i8* %4, i32 %1, i32 %8)
br label %16
14: ; preds = %2
%15 = call i32 @_assert_null_found(i8* %4)
br label %16
16: ; preds = %14, %12, %10
%17 = phi i32 [ %11, %10 ], [ %13, %12 ], [ %15, %14 ]
ret i32 %17
}