#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 count(char *);
int /*<<< orphan*/ fail_test(int);
void test_load() {
  if (count("empty_r1") != 0)
    fail_test(137);
  ;
  if (count("one_r1") != 1)
    fail_test(139);
  ;
  if (count("two_r2") != 2)
    fail_test(141);
  ;
}


x86 assembly (clang, -O0):
<test_load>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <count@plt>
cmp    $0x0,%eax
je     1143 <test_load+0x23>
mov    $0x89,%edi
call   1040 <fail_test@plt>
lea    0xebf(%rip),%rdi
call   1030 <count@plt>
cmp    $0x1,%eax
je     1162 <test_load+0x42>
mov    $0x8b,%edi
call   1040 <fail_test@plt>
lea    0xea7(%rip),%rdi
call   1030 <count@plt>
cmp    $0x2,%eax
je     1181 <test_load+0x61>
mov    $0x8d,%edi
call   1040 <fail_test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_load>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <count@plt>
test   %eax,%eax
je     113b <test_load+0x1b>
mov    $0x89,%edi
call   1040 <fail_test@plt>
lea    0xec7(%rip),%rdi
call   1030 <count@plt>
cmp    $0x1,%eax
je     1156 <test_load+0x36>
mov    $0x8b,%edi
call   1040 <fail_test@plt>
lea    0xeb3(%rip),%rdi
call   1030 <count@plt>
cmp    $0x2,%eax
jne    1169 <test_load+0x49>
pop    %rax
ret
mov    $0x8d,%edi
pop    %rax
jmp    1040 <fail_test@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"empty_r1\00"
@.str.1 = [7 x i8] c"one_r1\00"
@.str.2 = [7 x i8] c"two_r2\00"
define void @test_load() {
%1 = call i32 @count(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @fail_test(i32 137)
br label %5
5: ; preds = %3, %0
%6 = call i32 @count(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp ne i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 @fail_test(i32 139)
br label %10
10: ; preds = %8, %5
%11 = call i32 @count(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @fail_test(i32 141)
br label %15
15: ; preds = %13, %10
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"empty_r1\00"
@.str.1 = [7 x i8] c"one_r1\00"
@.str.2 = [7 x i8] c"two_r2\00"
define void @test_load() {
%1 = tail call i32 @count(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @fail_test(i32 137)
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @count(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @fail_test(i32 139)
br label %10
10: ; preds = %8, %5
%11 = tail call i32 @count(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32 %11, 2
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @fail_test(i32 141)
br label %15
15: ; preds = %13, %10
ret void
}