#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
void assert(int truth) {
  static int count = 0;
  if (!truth) {
    fprintf(stderr, "failed assertion %d\n", count);
    exit(EXIT_FAILURE);
  } else {
    printf("Pass\n");
  }
  count += 1;
}


x86 assembly (clang, -O0):
<assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    116e <assert+0x3e>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    0x2ee8(%rip),%edx
lea    0xea5(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ebc(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eb3(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert>:
push   %rax
test   %edi,%edi
je     114a <assert+0x1a>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
addl   $0x1,0x2ef4(%rip)
pop    %rax
ret
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
mov    0x2ee3(%rip),%edx
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@assert.count = internal global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"failed assertion %d\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [6 x i8] c"Pass\0A\00"
define void @assert(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = load i32, i32* @assert.count
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11
%14 = load i32, i32* @assert.count
%15 = add nsw i32 %14, 1
store i32 %15, i32* @assert.count
ret void
}

LLVM IR (-O2):
@assert.count = internal unnamed_addr global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"failed assertion %d\0A\00"
@EXIT_FAILURE = global i32 0
@str = [5 x i8] c"Pass\00"
define void @assert(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = load i32, i32* @assert.count
%6 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%11 = load i32, i32* @assert.count
%12 = add nsw i32 %11, 1
store i32 %12, i32* @assert.count
ret void
}