void thin_assert(int expr, int line, const char *file, char *msg) {
  if (expr)
    return;
  if (((void *)0) != msg)
    thin_printf("THIN_ASSERT: line %d of %s, %s\n", line, file, msg);
  else
    thin_printf("THIN_ASSERT: line %d of %s\n", line, file);
  exit(-1);
}


x86 assembly (clang, -O0):
<thin_assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1146 <thin_assert+0x26>
add    $0x20,%rsp
pop    %rbp
ret
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
je     1170 <thin_assert+0x50>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <thin_printf@plt>
jmp    1185 <thin_assert+0x65>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <thin_printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<thin_assert>:
test   %edi,%edi
je     1125 <thin_assert+0x5>
ret
push   %rax
test   %rcx,%rcx
jne    1143 <thin_assert+0x23>
lea    0xeee(%rip),%rdi
xor    %eax,%eax
call   1030 <thin_printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1030 <thin_printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"THIN_ASSERT: line %d of %s, %s\0A\00"
@.str.1 = [28 x i8] c"THIN_ASSERT: line %d of %s\0A\00"
define void @thin_assert(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %4
ret void
12: ; preds = %4
%13 = load i8*, i8** %8
%14 = icmp ne i8* null, %13
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32, i32* %6
%17 = load i8*, i8** %7
%18 = load i8*, i8** %8
%19 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @thin_printf to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %16, i8* %17, i8* %18)
br label %24
20: ; preds = %12
%21 = load i32, i32* %6
%22 = load i8*, i8** %7
%23 = call i32 (i8*, i32, i8*, ...) bitcast (i32 (...)* @thin_printf to i32 (i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %21, i8* %22)
br label %24
24: ; preds = %20, %15
unreachable
}

LLVM IR (-O2):
@.str = [32 x i8] c"THIN_ASSERT: line %d of %s, %s\0A\00"
@.str.1 = [28 x i8] c"THIN_ASSERT: line %d of %s\0A\00"
define void @thin_assert(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %7, label %6
6: ; preds = %4
ret void
7: ; preds = %4
%8 = icmp eq i8* %3, null
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @thin_printf to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2, i8* %3)
br label %13
11: ; preds = %7
%12 = tail call i32 (i8*, i32, i8*, ...) bitcast (i32 (...)* @thin_printf to i32 (i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %2)
br label %13
13: ; preds = %11, %9
tail call void @exit(i32 -1)
unreachable
}