void test_htpass_authenticate_user_barney_valid() {
  printf("=== RUN: %s\n", __func__);
  int rc = htpass_authenticate_user("./src/htpass_test.htpasswd", "barney",
                                    "s3cret");
  printf("%s: barney - %d\n", __func__, rc);
  if (rc != 0)
    test_fail(__func__);
  printf("--- PASS: %s\n", __func__);
}


x86 assembly (clang, -O0):
<test_htpass_authenticate_user_barney_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec7(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
lea    0xef8(%rip),%rsi
lea    0xef8(%rip),%rdx
mov    $0x0,%al
call   1030 <htpass_authenticate_user@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xeeb(%rip),%rdi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
je     119c <test_htpass_authenticate_user_barney_valid+0x6c>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1050 <test_fail@plt>
lea    0xecf(%rip),%rdi
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_htpass_authenticate_user_barney_valid>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
lea    0xecc(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
lea    0xefa(%rip),%rsi
lea    0xefa(%rip),%rdx
xor    %eax,%eax
call   1030 <htpass_authenticate_user@plt>
mov    %eax,%ebp
lea    0xef1(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
je     118e <test_htpass_authenticate_user_barney_valid+0x5e>
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1050 <test_fail@plt>
lea    0xedd(%rip),%rdi
lea    0xe71(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"=== RUN: %s\0A\00"
@__func__.test_htpass_authenticate_user_barney_valid = [43 x i8] c"test_htpass_authenticate_user_barney_valid\00"
@.str.1 = [27 x i8] c"./src/htpass_test.htpasswd\00"
@.str.2 = [7 x i8] c"barney\00"
@.str.3 = [7 x i8] c"s3cret\00"
@.str.4 = [17 x i8] c"%s: barney - %d\0A\00"
@.str.5 = [14 x i8] c"--- PASS: %s\0A\00"
define void @test_htpass_authenticate_user_barney_valid() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @__func__.test_htpass_authenticate_user_barney_valid, i64 0, i64 0))
%3 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @htpass_authenticate_user to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @__func__.test_htpass_authenticate_user_barney_valid, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @test_fail to i32 (i8*, ...)*)(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @__func__.test_htpass_authenticate_user_barney_valid, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @__func__.test_htpass_authenticate_user_barney_valid, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"=== RUN: %s\0A\00"
@__func__.test_htpass_authenticate_user_barney_valid = [43 x i8] c"test_htpass_authenticate_user_barney_valid\00"
@.str.1 = [27 x i8] c"./src/htpass_test.htpasswd\00"
@.str.2 = [7 x i8] c"barney\00"
@.str.3 = [7 x i8] c"s3cret\00"
@.str.4 = [17 x i8] c"%s: barney - %d\0A\00"
@.str.5 = [14 x i8] c"--- PASS: %s\0A\00"
define void @test_htpass_authenticate_user_barney_valid() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @__func__.test_htpass_authenticate_user_barney_valid, i64 0, i64 0))
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @htpass_authenticate_user to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @__func__.test_htpass_authenticate_user_barney_valid, i64 0, i64 0), i32 %2)
%4 = icmp eq i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @test_fail to i32 (i8*, ...)*)(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @__func__.test_htpass_authenticate_user_barney_valid, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @__func__.test_htpass_authenticate_user_barney_valid, i64 0, i64 0))
ret void
}