void test_binn2() {
  char *obj1ptr, *obj2ptr;
  int obj1size, obj2size;
  test_virtual_types();
  test_int_conversion();
  test_binn_int_conversion();
  test_value_conversion();
  test_value_copy();
  init_udts();
  obj1ptr = test_create_object_1(&obj1size);
  obj2ptr = test_create_object_2(&obj2size);
  assert(obj1ptr != ((void *)0));
  assert(obj2ptr != ((void *)0));
  printf("obj1size=%d obj2size=%d\n", obj1size, obj2size);
  assert(obj1size == obj2size);
  test_binn_read(obj1ptr);
  test_binn_iter(0);
  test_binn_iter(1);
}


x86 assembly (clang, -O0):
<test_binn2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <test_virtual_types@plt>
mov    $0x0,%al
call   1090 <test_int_conversion@plt>
mov    $0x0,%al
call   1030 <test_binn_int_conversion@plt>
mov    $0x0,%al
call   10b0 <test_value_conversion@plt>
mov    $0x0,%al
call   10c0 <test_value_copy@plt>
mov    $0x0,%al
call   1070 <init_udts@plt>
lea    -0x14(%rbp),%rdi
mov    $0x0,%al
call   10d0 <test_create_object_1@plt>
cltq
mov    %rax,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1060 <test_create_object_2@plt>
cltq
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1080 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1080 <assert@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   10e0 <test_binn_read@plt>
xor    %edi,%edi
mov    $0x0,%al
call   10a0 <test_binn_iter@plt>
mov    $0x1,%edi
mov    $0x0,%al
call   10a0 <test_binn_iter@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_binn2>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <test_virtual_types@plt>
xor    %eax,%eax
call   1090 <test_int_conversion@plt>
xor    %eax,%eax
call   1030 <test_binn_int_conversion@plt>
xor    %eax,%eax
call   10b0 <test_value_conversion@plt>
xor    %eax,%eax
call   10c0 <test_value_copy@plt>
xor    %eax,%eax
call   1070 <init_udts@plt>
lea    0x4(%rsp),%rdi
xor    %eax,%eax
call   10d0 <test_create_object_1@plt>
movslq %eax,%rbx
mov    %rsp,%rdi
xor    %eax,%eax
call   1060 <test_create_object_2@plt>
mov    %eax,%ebp
xor    %edi,%edi
test   %ebx,%ebx
setne  %dil
xor    %eax,%eax
call   1080 <assert@plt>
xor    %edi,%edi
test   %ebp,%ebp
setne  %dil
xor    %eax,%eax
call   1080 <assert@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xdcc(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%eax
xor    %edi,%edi
cmp    (%rsp),%eax
sete   %dil
xor    %eax,%eax
call   1080 <assert@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   10e0 <test_binn_read@plt>
xor    %edi,%edi
xor    %eax,%eax
call   10a0 <test_binn_iter@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   10a0 <test_binn_iter@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"obj1size=%d obj2size=%d\0A\00"
define void @test_binn2() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (...) @test_virtual_types()
%6 = call i32 (...) @test_int_conversion()
%7 = call i32 (...) @test_binn_int_conversion()
%8 = call i32 (...) @test_value_conversion()
%9 = call i32 (...) @test_value_copy()
%10 = call i32 (...) @init_udts()
%11 = call i32 (i32*, ...) bitcast (i32 (...)* @test_create_object_1 to i32 (i32*, ...)*)(i32* %3)
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %1
%14 = call i32 (i32*, ...) bitcast (i32 (...)* @test_create_object_2 to i32 (i32*, ...)*)(i32* %4)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %2
%17 = load i8*, i8** %1
%18 = icmp ne i8* %17, null
%19 = zext i1 %18 to i32
%20 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %19)
%21 = load i8*, i8** %2
%22 = icmp ne i8* %21, null
%23 = zext i1 %22 to i32
%24 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %23)
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %26)
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = icmp eq i32 %28, %29
%31 = zext i1 %30 to i32
%32 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %31)
%33 = load i8*, i8** %1
%34 = call i32 (i8*, ...) bitcast (i32 (...)* @test_binn_read to i32 (i8*, ...)*)(i8* %33)
%35 = call i32 (i32, ...) bitcast (i32 (...)* @test_binn_iter to i32 (i32, ...)*)(i32 0)
%36 = call i32 (i32, ...) bitcast (i32 (...)* @test_binn_iter to i32 (i32, ...)*)(i32 1)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"obj1size=%d obj2size=%d\0A\00"
define void @test_binn2() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (...) @test_virtual_types()
%6 = tail call i32 (...) @test_int_conversion()
%7 = tail call i32 (...) @test_binn_int_conversion()
%8 = tail call i32 (...) @test_value_conversion()
%9 = tail call i32 (...) @test_value_copy()
%10 = tail call i32 (...) @init_udts()
%11 = call i32 (i32*, ...) bitcast (i32 (...)* @test_create_object_1 to i32 (i32*, ...)*)(i32* %1)
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i8*
%14 = call i32 (i32*, ...) bitcast (i32 (...)* @test_create_object_2 to i32 (i32*, ...)*)(i32* %2)
%15 = icmp ne i32 %11, 0
%16 = zext i1 %15 to i32
%17 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %16)
%18 = icmp ne i32 %14, 0
%19 = zext i1 %18 to i32
%20 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %19)
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %22)
%24 = load i32, i32* %1
%25 = load i32, i32* %2
%26 = icmp eq i32 %24, %25
%27 = zext i1 %26 to i32
%28 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %27)
%29 = call i32 (i8*, ...) bitcast (i32 (...)* @test_binn_read to i32 (i8*, ...)*)(i8* %13)
%30 = call i32 (i32, ...) bitcast (i32 (...)* @test_binn_iter to i32 (i32, ...)*)(i32 0)
%31 = call i32 (i32, ...) bitcast (i32 (...)* @test_binn_iter to i32 (i32, ...)*)(i32 1)
ret void
}