#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 /*<<< orphan*/ F_OK;
int /*<<< orphan*/ R_OK;
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int get_uri_status(char *uri) {
  if (access(uri, F_OK) == -1) {
    fprintf(stderr, "File: %s not found.\n", uri);
    return 404;
  }
  if (access(uri, R_OK) == -1) {
    fprintf(stderr, "File: %s can not read.\n", uri);
    return 403;
  }
  return 200;
}


x86 assembly (clang, -O0):
<get_uri_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%esi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
jne    116c <get_uri_status+0x4c>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xea5(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x194,-0x4(%rbp)
jmp    11b3 <get_uri_status+0x93>
mov    -0x10(%rbp),%rdi
mov    0x2e61(%rip),%rax
mov    (%rax),%esi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
jne    11ac <get_uri_status+0x8c>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe7a(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x193,-0x4(%rbp)
jmp    11b3 <get_uri_status+0x93>
movl   $0xc8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_uri_status>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
call   1040 <access@plt>
cmp    $0xffffffff,%eax
je     1162 <get_uri_status+0x42>
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <access@plt>
mov    $0xc8,%ebp
cmp    $0xffffffff,%eax
jne    117f <get_uri_status+0x5f>
mov    $0x193,%ebp
lea    0xeb5(%rip),%rsi
jmp    116e <get_uri_status+0x4e>
mov    $0x194,%ebp
lea    0xe92(%rip),%rsi
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@F_OK = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"File: %s not found.\0A\00"
@R_OK = global i32 0
@.str.1 = [24 x i8] c"File: %s can not read.\0A\00"
define i32 @get_uri_status(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i32, i32* @F_OK
%6 = call i32 @access(i8* %4, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %3
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %10)
store i32 404, i32* %2
br label %22
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = load i32, i32* @R_OK
%15 = call i32 @access(i8* %13, i32 %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %3
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %19)
store i32 403, i32* %2
br label %22
21: ; preds = %12
store i32 200, i32* %2
br label %22
22: ; preds = %21, %17, %8
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@F_OK = global i32 0
@stderr = global i32 0
@.str = [21 x i8] c"File: %s not found.\0A\00"
@R_OK = global i32 0
@.str.1 = [24 x i8] c"File: %s can not read.\0A\00"
define i32 @get_uri_status(i8* %0) {
%2 = load i32, i32* @F_OK
%3 = tail call i32 @access(i8* %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = load i32, i32* @R_OK
%7 = tail call i32 @access(i8* %0, i32 %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %14
9: ; preds = %5, %1
%10 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), %5 ]
%11 = phi i32 [ 404, %1 ], [ 403, %5 ]
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* %10, i8* %0)
br label %14
14: ; preds = %9, %5
%15 = phi i32 [ 200, %5 ], [ %11, %9 ]
ret i32 %15
}