void test_htpass_authenticate_user_fred_invalid1() {
  printf("=== RUN: %s\n", __func__);
  int rc = htpass_authenticate_user("./src/htpass_test.htpasswd", "fred",
                                    "passw0rd ");
  printf("%s: fred - %d\n", __func__, rc);
  if (rc != 2)
    test_fail(__func__);
  printf("--- PASS: %s\n", __func__);
}


x86 assembly (clang, -O0):
<test_htpass_authenticate_user_fred_invalid1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec7(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee5(%rip),%rdi
lea    0xef9(%rip),%rsi
lea    0xef7(%rip),%rdx
mov    $0x0,%al
call   1030 <htpass_authenticate_user@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xeed(%rip),%rdi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x2,-0x4(%rbp)
je     119c <test_htpass_authenticate_user_fred_invalid1+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_fred_invalid1>:
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    0xee7(%rip),%rdi
lea    0xefb(%rip),%rsi
lea    0xef9(%rip),%rdx
xor    %eax,%eax
call   1030 <htpass_authenticate_user@plt>
mov    %eax,%ebp
lea    0xef3(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebp
je     118f <test_htpass_authenticate_user_fred_invalid1+0x5f>
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1050 <test_fail@plt>
lea    0xedc(%rip),%rdi
lea    0xe70(%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_fred_invalid1 = [44 x i8] c"test_htpass_authenticate_user_fred_invalid1\00"
@.str.1 = [27 x i8] c"./src/htpass_test.htpasswd\00"
@.str.2 = [5 x i8] c"fred\00"
@.str.3 = [10 x i8] c"passw0rd \00"
@.str.4 = [15 x i8] c"%s: fred - %d\0A\00"
@.str.5 = [14 x i8] c"--- PASS: %s\0A\00"
define void @test_htpass_authenticate_user_fred_invalid1() {
%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 ([44 x i8], [44 x i8]* @__func__.test_htpass_authenticate_user_fred_invalid1, 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 ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 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 ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @__func__.test_htpass_authenticate_user_fred_invalid1, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @test_fail to i32 (i8*, ...)*)(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @__func__.test_htpass_authenticate_user_fred_invalid1, 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 ([44 x i8], [44 x i8]* @__func__.test_htpass_authenticate_user_fred_invalid1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"=== RUN: %s\0A\00"
@__func__.test_htpass_authenticate_user_fred_invalid1 = [44 x i8] c"test_htpass_authenticate_user_fred_invalid1\00"
@.str.1 = [27 x i8] c"./src/htpass_test.htpasswd\00"
@.str.2 = [5 x i8] c"fred\00"
@.str.3 = [10 x i8] c"passw0rd \00"
@.str.4 = [15 x i8] c"%s: fred - %d\0A\00"
@.str.5 = [14 x i8] c"--- PASS: %s\0A\00"
define void @test_htpass_authenticate_user_fred_invalid1() {
%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 ([44 x i8], [44 x i8]* @__func__.test_htpass_authenticate_user_fred_invalid1, 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 ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @__func__.test_htpass_authenticate_user_fred_invalid1, i64 0, i64 0), i32 %2)
%4 = icmp eq i32 %2, 2
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 ([44 x i8], [44 x i8]* @__func__.test_htpass_authenticate_user_fred_invalid1, 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 ([44 x i8], [44 x i8]* @__func__.test_htpass_authenticate_user_fred_invalid1, i64 0, i64 0))
ret void
}