#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int check_user_token(char *, char *, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int mkstemp(char *);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ stdout;
void test_check_user_token(void) {
  char file[] = "/tmp/pamtest.XXXXXX";
  int fd = mkstemp(file);
  FILE *handle;
  int ret;
  assert(fd != -1);
  handle = fdopen(fd, "w");
  fprintf(handle, "# This is a comment containing foobar:foobar\n");
  fprintf(handle, "foobar:hhhvhvhdhbid:hnhbhnhbhnhb:\n");
  fprintf(handle, "# This is a comment in the middle\n");
  fprintf(handle, "kaka:hdhrhbhjhvhu:hihbhdhrhbhj\n");
  fprintf(handle, "# foo2 is a user showing up twice in the file\n");
  fprintf(handle, "foo2:vvvvvvvvvvvv\n");
  fprintf(handle, "bar:hnhbhnhbhnhb\n");
  fprintf(handle, "foo2:cccccccccccc\n");
  fclose(handle);
  ret = check_user_token(file, "foobar", "hhhvhvhdhbid", 1, stdout);
  assert(ret == 1);
  ret = check_user_token(file, "foobar", "hnhbhnhbhnhb", 1, stdout);
  assert(ret == 1);
  ret = check_user_token(file, "foobar", "hnhbhnhbhnhc", 1, stdout);
  assert(ret == -1);
  ret = check_user_token(file, "kaka", "hihbhdhrhbhj", 1, stdout);
  assert(ret == 1);
  ret = check_user_token(file, "bar", "hnhbhnhbhnhb", 1, stdout);
  assert(ret == 1);
  ret = check_user_token(file, "foo", "hdhrhbhjhvhu", 1, stdout);
  assert(ret == -2);
  ret = check_user_token(file, "foo2", "cccccccccccc", 1, stdout);
  assert(ret == 1);
  ret = check_user_token(file, "foo2", "vvvvvvvvvvvv", 1, stdout);
  assert(ret == 1);
  ret = check_user_token(file, "foo2", "vvvvvvvvvvcc", 1, stdout);
  assert(ret == -1);
  ret = check_user_token(file, "foo2", "", 1, stdout);
  assert(ret == -1);
  ret = check_user_token(file, "foo", "", 1, stdout);
  assert(ret == -2);
  remove(file);
}


x86 assembly (clang, -O0):
<test_check_user_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xe81(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe7e(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe7c(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1080 <mkstemp@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x24(%rbp),%edi
lea    0xe56(%rip),%rsi
call   1090 <fdopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xe44(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xe62(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x20(%rbp),%rdi
mov    0x2d85(%rip),%rax
mov    (%rax),%r8d
lea    0xeac(%rip),%rsi
lea    0xeac(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    0x2d4b(%rip),%rax
mov    (%rax),%r8d
lea    0xe72(%rip),%rsi
lea    0xe7f(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    0x2d11(%rip),%rax
mov    (%rax),%r8d
lea    0xe38(%rip),%rsi
lea    0xe52(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    0x2cd7(%rip),%rax
mov    (%rax),%r8d
lea    0xe2c(%rip),%rsi
lea    0xe2a(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    0x2c9d(%rip),%rax
mov    (%rax),%r8d
lea    0xdc7(%rip),%rsi
lea    0xdd1(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    0x2c63(%rip),%rax
mov    (%rax),%r8d
lea    0xdca(%rip),%rsi
lea    0xdc7(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xfffffffe,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    0x2c29(%rip),%rax
mov    (%rax),%r8d
lea    0xda1(%rip),%rsi
lea    0xd9f(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    0x2bef(%rip),%rax
mov    (%rax),%r8d
lea    0xd67(%rip),%rsi
lea    0xd72(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    0x2bb5(%rip),%rax
mov    (%rax),%r8d
lea    0xd2d(%rip),%rsi
lea    0xd45(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    0x2b7b(%rip),%rax
mov    (%rax),%r8d
lea    0xcf3(%rip),%rsi
lea    0xbf0(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
mov    0x2b41(%rip),%rax
mov    (%rax),%r8d
lea    0xca8(%rip),%rsi
lea    0xbb6(%rip),%rdx
mov    $0x1,%ecx
call   1070 <check_user_token@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xfffffffe,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
call   1030 <remove@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_check_user_token>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
movaps 0xe7c(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x585858,0x10(%rsp)
mov    %rsp,%r15
mov    %r15,%rdi
call   1070 <mkstemp@plt>
mov    %eax,%ebx
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
call   1050 <assert@plt>
lea    0xe62(%rip),%rsi
mov    %ebx,%edi
call   1080 <fdopen@plt>
mov    %rax,%rbx
lea    0xe53(%rip),%rdi
mov    $0x2d,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1090 <fwrite@plt>
lea    0xe68(%rip),%rdi
mov    $0x22,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xe72(%rip),%rdi
mov    $0x22,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xe7c(%rip),%rdi
mov    $0x1f,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xe83(%rip),%rdi
mov    $0x2e,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xe99(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xe93(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0xe8c(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2d4d(%rip),%r13
mov    0x0(%r13),%r8d
lea    0xe73(%rip),%rbx
lea    0xe73(%rip),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x0(%r13),%r8d
lea    0xe57(%rip),%r14
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x0(%r13),%r8d
lea    0xe38(%rip),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x0(%r13),%r8d
lea    0xe1c(%rip),%rsi
lea    0xe1a(%rip),%rdx
mov    %r15,%rdi
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x0(%r13),%r8d
lea    0xdc4(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x0(%r13),%r8d
lea    0xdd8(%rip),%r14
lea    0xdd5(%rip),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0xfffffffe,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x0(%r13),%r8d
lea    0xdb9(%rip),%r12
lea    0xdb7(%rip),%rdx
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x0(%r13),%r8d
lea    0xd9b(%rip),%rdx
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x0(%r13),%r8d
lea    0xd7f(%rip),%rdx
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x0(%r13),%r8d
lea    0xc3b(%rip),%rbx
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1050 <assert@plt>
mov    0x0(%r13),%r8d
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    $0x1,%ecx
call   1060 <check_user_token@plt>
xor    %edi,%edi
cmp    $0xfffffffe,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r15,%rdi
call   1030 <remove@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.test_check_user_token.file = [20 x i8] c"/tmp/pamtest.XXXXXX\00"
@.str = [2 x i8] c"w\00"
@.str.1 = [46 x i8] c"# This is a comment containing foobar:foobar\0A\00"
@.str.2 = [35 x i8] c"foobar:hhhvhvhdhbid:hnhbhnhbhnhb:\0A\00"
@.str.3 = [35 x i8] c"# This is a comment in the middle\0A\00"
@.str.4 = [32 x i8] c"kaka:hdhrhbhjhvhu:hihbhdhrhbhj\0A\00"
@.str.5 = [47 x i8] c"# foo2 is a user showing up twice in the file\0A\00"
@.str.6 = [19 x i8] c"foo2:vvvvvvvvvvvv\0A\00"
@.str.7 = [18 x i8] c"bar:hnhbhnhbhnhb\0A\00"
@.str.8 = [19 x i8] c"foo2:cccccccccccc\0A\00"
@.str.9 = [7 x i8] c"foobar\00"
@.str.10 = [13 x i8] c"hhhvhvhdhbid\00"
@stdout = global i32 0
@.str.11 = [13 x i8] c"hnhbhnhbhnhb\00"
@.str.12 = [13 x i8] c"hnhbhnhbhnhc\00"
@.str.13 = [5 x i8] c"kaka\00"
@.str.14 = [13 x i8] c"hihbhdhrhbhj\00"
@.str.15 = [4 x i8] c"bar\00"
@.str.16 = [4 x i8] c"foo\00"
@.str.17 = [13 x i8] c"hdhrhbhjhvhu\00"
@.str.18 = [5 x i8] c"foo2\00"
@.str.19 = [13 x i8] c"cccccccccccc\00"
@.str.20 = [13 x i8] c"vvvvvvvvvvvv\00"
@.str.21 = [13 x i8] c"vvvvvvvvvvcc\00"
@.str.22 = [1 x i8] zeroinitializer
define void @test_check_user_token() {
%1 = alloca [20 x i8]
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = bitcast [20 x i8]* %1 to i8*
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%7 = call i32 @mkstemp(i8* %6)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, -1
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %2
%13 = call i32* @fdopen(i32 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %3
%14 = load i32*, i32** %3
%15 = call i32 @fprintf(i32* %14, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32*, i32** %3
%17 = call i32 @fprintf(i32* %16, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32*, i32** %3
%19 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32*, i32** %3
%21 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%22 = load i32*, i32** %3
%23 = call i32 @fprintf(i32* %22, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0))
%24 = load i32*, i32** %3
%25 = call i32 @fprintf(i32* %24, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%26 = load i32*, i32** %3
%27 = call i32 @fprintf(i32* %26, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%28 = load i32*, i32** %3
%29 = call i32 @fprintf(i32* %28, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
%30 = load i32*, i32** %3
%31 = call i32 @fclose(i32* %30)
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%33 = load i32, i32* @stdout
%34 = call i32 @check_user_token(i8* %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 1, i32 %33)
store i32 %34, i32* %4
%35 = load i32, i32* %4
%36 = icmp eq i32 %35, 1
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%40 = load i32, i32* @stdout
%41 = call i32 @check_user_token(i8* %39, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 %40)
store i32 %41, i32* %4
%42 = load i32, i32* %4
%43 = icmp eq i32 %42, 1
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%47 = load i32, i32* @stdout
%48 = call i32 @check_user_token(i8* %46, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 1, i32 %47)
store i32 %48, i32* %4
%49 = load i32, i32* %4
%50 = icmp eq i32 %49, -1
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%54 = load i32, i32* @stdout
%55 = call i32 @check_user_token(i8* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i32 1, i32 %54)
store i32 %55, i32* %4
%56 = load i32, i32* %4
%57 = icmp eq i32 %56, 1
%58 = zext i1 %57 to i32
%59 = call i32 @assert(i32 %58)
%60 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%61 = load i32, i32* @stdout
%62 = call i32 @check_user_token(i8* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 %61)
store i32 %62, i32* %4
%63 = load i32, i32* %4
%64 = icmp eq i32 %63, 1
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%68 = load i32, i32* @stdout
%69 = call i32 @check_user_token(i8* %67, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0), i32 1, i32 %68)
store i32 %69, i32* %4
%70 = load i32, i32* %4
%71 = icmp eq i32 %70, -2
%72 = zext i1 %71 to i32
%73 = call i32 @assert(i32 %72)
%74 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%75 = load i32, i32* @stdout
%76 = call i32 @check_user_token(i8* %74, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0), i32 1, i32 %75)
store i32 %76, i32* %4
%77 = load i32, i32* %4
%78 = icmp eq i32 %77, 1
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
%81 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%82 = load i32, i32* @stdout
%83 = call i32 @check_user_token(i8* %81, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0), i32 1, i32 %82)
store i32 %83, i32* %4
%84 = load i32, i32* %4
%85 = icmp eq i32 %84, 1
%86 = zext i1 %85 to i32
%87 = call i32 @assert(i32 %86)
%88 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%89 = load i32, i32* @stdout
%90 = call i32 @check_user_token(i8* %88, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.21, i64 0, i64 0), i32 1, i32 %89)
store i32 %90, i32* %4
%91 = load i32, i32* %4
%92 = icmp eq i32 %91, -1
%93 = zext i1 %92 to i32
%94 = call i32 @assert(i32 %93)
%95 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%96 = load i32, i32* @stdout
%97 = call i32 @check_user_token(i8* %95, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.22, i64 0, i64 0), i32 1, i32 %96)
store i32 %97, i32* %4
%98 = load i32, i32* %4
%99 = icmp eq i32 %98, -1
%100 = zext i1 %99 to i32
%101 = call i32 @assert(i32 %100)
%102 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%103 = load i32, i32* @stdout
%104 = call i32 @check_user_token(i8* %102, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.22, i64 0, i64 0), i32 1, i32 %103)
store i32 %104, i32* %4
%105 = load i32, i32* %4
%106 = icmp eq i32 %105, -2
%107 = zext i1 %106 to i32
%108 = call i32 @assert(i32 %107)
%109 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%110 = call i32 @remove(i8* %109)
ret void
}

LLVM IR (-O2):
@__const.test_check_user_token.file = [20 x i8] c"/tmp/pamtest.XXXXXX\00"
@.str = [2 x i8] c"w\00"
@.str.1 = [46 x i8] c"# This is a comment containing foobar:foobar\0A\00"
@.str.2 = [35 x i8] c"foobar:hhhvhvhdhbid:hnhbhnhbhnhb:\0A\00"
@.str.3 = [35 x i8] c"# This is a comment in the middle\0A\00"
@.str.4 = [32 x i8] c"kaka:hdhrhbhjhvhu:hihbhdhrhbhj\0A\00"
@.str.5 = [47 x i8] c"# foo2 is a user showing up twice in the file\0A\00"
@.str.6 = [19 x i8] c"foo2:vvvvvvvvvvvv\0A\00"
@.str.7 = [18 x i8] c"bar:hnhbhnhbhnhb\0A\00"
@.str.8 = [19 x i8] c"foo2:cccccccccccc\0A\00"
@.str.9 = [7 x i8] c"foobar\00"
@.str.10 = [13 x i8] c"hhhvhvhdhbid\00"
@stdout = global i32 0
@.str.11 = [13 x i8] c"hnhbhnhbhnhb\00"
@.str.12 = [13 x i8] c"hnhbhnhbhnhc\00"
@.str.13 = [5 x i8] c"kaka\00"
@.str.14 = [13 x i8] c"hihbhdhrhbhj\00"
@.str.15 = [4 x i8] c"bar\00"
@.str.16 = [4 x i8] c"foo\00"
@.str.17 = [13 x i8] c"hdhrhbhjhvhu\00"
@.str.18 = [5 x i8] c"foo2\00"
@.str.19 = [13 x i8] c"cccccccccccc\00"
@.str.20 = [13 x i8] c"vvvvvvvvvvvv\00"
@.str.21 = [13 x i8] c"vvvvvvvvvvcc\00"
@.str.22 = [1 x i8] zeroinitializer
define void @test_check_user_token() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @mkstemp(i8* %2)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call i32* @fdopen(i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i64 45, i64 1, i32* %7)
%9 = call i64 @fwrite(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i64 34, i64 1, i32* %7)
%10 = call i64 @fwrite(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i64 34, i64 1, i32* %7)
%11 = call i64 @fwrite(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i64 31, i64 1, i32* %7)
%12 = call i64 @fwrite(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i64 46, i64 1, i32* %7)
%13 = call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i64 18, i64 1, i32* %7)
%14 = call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i64 17, i64 1, i32* %7)
%15 = call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i64 18, i64 1, i32* %7)
%16 = call i32 @fclose(i32* %7)
%17 = load i32, i32* @stdout
%18 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 1, i32 %17)
%19 = icmp eq i32 %18, 1
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32, i32* @stdout
%23 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 %22)
%24 = icmp eq i32 %23, 1
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i32, i32* @stdout
%28 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 1, i32 %27)
%29 = icmp eq i32 %28, -1
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load i32, i32* @stdout
%33 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i32 1, i32 %32)
%34 = icmp eq i32 %33, 1
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = load i32, i32* @stdout
%38 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 %37)
%39 = icmp eq i32 %38, 1
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = load i32, i32* @stdout
%43 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0), i32 1, i32 %42)
%44 = icmp eq i32 %43, -2
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
%47 = load i32, i32* @stdout
%48 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0), i32 1, i32 %47)
%49 = icmp eq i32 %48, 1
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
%52 = load i32, i32* @stdout
%53 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.20, i64 0, i64 0), i32 1, i32 %52)
%54 = icmp eq i32 %53, 1
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = load i32, i32* @stdout
%58 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.21, i64 0, i64 0), i32 1, i32 %57)
%59 = icmp eq i32 %58, -1
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
%62 = load i32, i32* @stdout
%63 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.22, i64 0, i64 0), i32 1, i32 %62)
%64 = icmp eq i32 %63, -1
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = load i32, i32* @stdout
%68 = call i32 @check_user_token(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.22, i64 0, i64 0), i32 1, i32 %67)
%69 = icmp eq i32 %68, -2
%70 = zext i1 %69 to i32
%71 = call i32 @assert(i32 %70)
%72 = call i32 @remove(i8* %2)
ret void
}