_assert(assertion, filename, line_num) char *assertion;
char *filename;
int line_num;
{
  static char linestr[] = ", line NNNNN\n";
  register char *p = &linestr[7];
  register int div, digit;
  (void)write(2, (("Assertion failed: ")), (18)),
      (void)write(2, ((assertion)), ((unsigned)strlen(assertion)));
  (void)write(2, ((", file ")), (7)),
      (void)write(2, ((filename)), ((unsigned)strlen(filename)));
  for (div = 10000; div != 0; line_num %= div, div /= 10)
    if ((digit = line_num / div) != 0 || p != &linestr[7] || div == 1)
      *p++ = digit + '0';
  *p++ = '\n';
  *p = '\0';
  (void)write(2, (linestr), ((unsigned)strlen(linestr)));
  (void)abort();
}


x86 assembly (clang, -O0):
<_assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0x2eee(%rip),%rax
add    $0x7,%rax
mov    %rax,-0x20(%rbp)
mov    $0x2,%edi
lea    0xea2(%rip),%rsi
mov    $0x12,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
mov    $0x2,%edi
mov    $0x0,%al
call   1040 <write@plt>
mov    $0x2,%edi
lea    0xe7a(%rip),%rsi
mov    $0x7,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
mov    $0x2,%edi
mov    $0x0,%al
call   1040 <write@plt>
movl   $0x2710,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1248 <_assert+0x118>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jne    120b <_assert+0xdb>
lea    0x2e45(%rip),%rax
add    $0x7,%rax
cmp    %rax,-0x20(%rbp)
jne    120b <_assert+0xdb>
cmpl   $0x1,-0x24(%rbp)
jne    1224 <_assert+0xf4>
mov    -0x28(%rbp),%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    1229 <_assert+0xf9>
mov    -0x24(%rbp),%ecx
mov    -0x14(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x24(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
jmp    11cf <_assert+0x9f>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0xa,(%rax)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2dd0(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%edx
mov    $0x2,%edi
lea    0x2dbd(%rip),%rsi
mov    $0x0,%al
call   1040 <write@plt>
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<_assert>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebb(%rip),%rsi
mov    $0x2,%edi
mov    $0x12,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <write@plt>
lea    0xe9d(%rip),%rsi
mov    $0x2,%edi
mov    $0x7,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    $0x2,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <write@plt>
lea    0x270f(%r15),%ecx
cmp    $0x4e1f,%ecx
jae    11f0 <_assert+0xc0>
movswl %r15w,%eax
imul   $0x1a37,%eax,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x1a,%eax
add    %edx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%r15d
movswl %r15w,%r15d
lea    0x2e68(%rip),%rax
cmp    $0x4e1e,%ecx
ja     1220 <_assert+0xf0>
lea    0x3e7(%r15),%ecx
cmp    $0x7cf,%ecx
jb     1247 <_assert+0x117>
jmp    1220 <_assert+0xf0>
movslq %r15d,%rax
imul   $0x68db8bad,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
lea    0x30(%rax),%ecx
mov    %cl,0x2e2f(%rip)
imul   $0x2710,%eax,%eax
sub    %eax,%r15d
lea    0x2e20(%rip),%rax
movswl %r15w,%ecx
imul   $0xffff8313,%ecx,%ecx
shr    $0x10,%ecx
add    %r15d,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
sar    $0x9,%edx
add    %ecx,%edx
add    $0x30,%dl
mov    %dl,(%rax)
add    $0x1,%rax
movswl %r15w,%ecx
imul   $0xffff8313,%ecx,%ecx
shr    $0x10,%ecx
add    %r15d,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
sar    $0x9,%edx
add    %ecx,%edx
imul   $0x3e8,%edx,%ecx
mov    %r15d,%edx
sub    %ecx,%edx
neg    %ecx
add    %r15d,%ecx
add    $0xffffff9c,%ecx
movzwl %cx,%esi
lea    0x2dbd(%rip),%rcx
movswl %dx,%edx
cmp    $0xff39,%esi
jb     129c <_assert+0x16c>
lea    0x2dab(%rip),%rdi
mov    %rcx,%rsi
cmp    %rdi,%rax
je     12ba <_assert+0x18a>
imul   $0x147b,%edx,%esi
mov    %esi,%edi
shr    $0x1f,%edi
shr    $0x13,%esi
add    %edi,%esi
add    $0x30,%sil
mov    %sil,(%rax)
add    $0x1,%rax
mov    %rax,%rsi
imul   $0x147b,%edx,%eax
mov    %eax,%edi
shr    $0x1f,%edi
sar    $0x13,%eax
add    %edi,%eax
imul   $0x64,%eax,%eax
sub    %eax,%edx
mov    %edx,%eax
add    $0xfffffff6,%eax
cmp    $0xffed,%ax
jb     12e6 <_assert+0x1b6>
lea    0x2d5e(%rip),%rax
cmp    %rax,%rsi
je     1306 <_assert+0x1d6>
movsbl %dl,%eax
imul   $0x67,%eax,%eax
movzwl %ax,%eax
movswl %ax,%ecx
shr    $0xf,%eax
shr    $0xa,%ecx
add    %al,%cl
add    $0x30,%cl
mov    %cl,(%rsi)
add    $0x1,%rsi
mov    %rsi,%rcx
movsbl %dl,%eax
imul   $0x67,%eax,%edx
movzwl %dx,%edx
movswl %dx,%esi
shr    $0xf,%edx
shr    $0xa,%esi
add    %dl,%sil
movzbl %sil,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%al
add    $0x30,%al
mov    %al,(%rcx)
movw   $0xa,0x1(%rcx)
lea    0x2d01(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <write@plt>
call   1030 <abort@plt>

LLVM IR (-O0):
@_assert.linestr = internal global [14 x i8] c", line NNNNN\0A\00"
@.str = [19 x i8] c"Assertion failed: \00"
@.str.1 = [8 x i8] c", file \00"
define i32 @_assert(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 7), i8** %7
%10 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 18)
%11 = load i8*, i8** %4
%12 = load i8*, i8** %4
%13 = call i64 @strlen(i8* %12)
%14 = trunc i64 %13 to i32
%15 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 2, i8* %11, i32 %14)
%16 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%17 = load i8*, i8** %5
%18 = load i8*, i8** %5
%19 = call i64 @strlen(i8* %18)
%20 = trunc i64 %19 to i32
%21 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 2, i8* %17, i32 %20)
store i32 10000, i32* %8
br label %22
22: ; preds = %43, %3
%23 = load i32, i32* %8
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %49
25: ; preds = %22
%26 = load i32, i32* %6
%27 = load i32, i32* %8
%28 = sdiv i32 %26, %27
store i32 %28, i32* %9
%29 = icmp ne i32 %28, 0
br i1 %29, label %36, label %30
30: ; preds = %25
%31 = load i8*, i8** %7
%32 = icmp ne i8* %31, getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 7)
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = load i32, i32* %8
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %42
36: ; preds = %33, %30, %25
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 48
%39 = trunc i32 %38 to i8
%40 = load i8*, i8** %7
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %7
store i8 %39, i8* %40
br label %42
42: ; preds = %36, %33
br label %43
43: ; preds = %42
%44 = load i32, i32* %8
%45 = load i32, i32* %6
%46 = srem i32 %45, %44
store i32 %46, i32* %6
%47 = load i32, i32* %8
%48 = sdiv i32 %47, 10
store i32 %48, i32* %8
br label %22
49: ; preds = %22
%50 = load i8*, i8** %7
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %7
store i8 10, i8* %50
%52 = load i8*, i8** %7
store i8 0, i8* %52
%53 = call i64 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 0))
%54 = trunc i64 %53 to i32
%55 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 0), i32 %54)
unreachable
}

LLVM IR (-O2):
@_assert.linestr = internal global [14 x i8] c", line NNNNN\0A\00"
@.str = [19 x i8] c"Assertion failed: \00"
@.str.1 = [8 x i8] c", file \00"
define i32 @_assert(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 18)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = trunc i64 %5 to i32
%7 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 2, i8* %0, i32 %6)
%8 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%9 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%10 = trunc i64 %9 to i32
%11 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 2, i8* %1, i32 %10)
%12 = add i32 %2, 9999
%13 = icmp ult i32 %12, 19999
br i1 %13, label %19, label %14
14: ; preds = %3
%15 = sdiv i32 %2, 10000
%16 = trunc i32 %15 to i8
%17 = add i8 %16, 48
store i8 %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 7)
%18 = srem i32 %2, 10000
br label %26
19: ; preds = %3
%20 = trunc i32 %2 to i16
%21 = srem i16 %20, 10000
%22 = sext i16 %21 to i32
%23 = add nsw i32 %22, 999
%24 = icmp ult i32 %23, 1999
%25 = and i1 %13, %24
br i1 %25, label %34, label %26
26: ; preds = %14, %19
%27 = phi i32 [ %18, %14 ], [ %22, %19 ]
%28 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 8), %14 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 7), %19 ]
%29 = trunc i32 %27 to i16
%30 = sdiv i16 %29, 1000
%31 = trunc i16 %30 to i8
%32 = add nsw i8 %31, 48
%33 = getelementptr inbounds i8, i8* %28, i64 1
store i8 %32, i8* %28
br label %34
34: ; preds = %26, %19
%35 = phi i32 [ %27, %26 ], [ %22, %19 ]
%36 = phi i8* [ %33, %26 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 7), %19 ]
%37 = trunc i32 %35 to i16
%38 = srem i16 %37, 1000
%39 = add nsw i16 %38, -100
%40 = icmp ult i16 %39, -199
%41 = icmp ne i8* %36, getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 7)
%42 = select i1 %40, i1 true, i1 %41
br i1 %42, label %43, label %48
43: ; preds = %34
%44 = sdiv i16 %38, 100
%45 = trunc i16 %44 to i8
%46 = add nsw i8 %45, 48
%47 = getelementptr inbounds i8, i8* %36, i64 1
store i8 %46, i8* %36
br label %48
48: ; preds = %43, %34
%49 = phi i8* [ %47, %43 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 7), %34 ]
%50 = srem i16 %38, 100
%51 = add nsw i16 %50, -10
%52 = icmp ult i16 %51, -19
%53 = icmp ne i8* %49, getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 7)
%54 = select i1 %52, i1 true, i1 %53
br i1 %54, label %55, label %60
55: ; preds = %48
%56 = trunc i16 %50 to i8
%57 = sdiv i8 %56, 10
%58 = add nsw i8 %57, 48
%59 = getelementptr inbounds i8, i8* %49, i64 1
store i8 %58, i8* %49
br label %60
60: ; preds = %55, %48
%61 = phi i8* [ %59, %55 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 7), %48 ]
%62 = trunc i16 %50 to i8
%63 = srem i8 %62, 10
%64 = add nsw i8 %63, 48
%65 = getelementptr inbounds i8, i8* %61, i64 1
store i8 %64, i8* %61
%66 = getelementptr inbounds i8, i8* %61, i64 2
store i8 10, i8* %65
store i8 0, i8* %66
%67 = tail call i64 @strlen(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 0))
%68 = trunc i64 %67 to i32
%69 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @_assert.linestr, i64 0, i64 0), i32 %68)
tail call void @abort()
unreachable
}