#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char *getenv(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stor_internopts(char *);
void check_for_xpprc() {
  FILE *fp;
  char rc[256];
  char bob[256];
  sprintf(rc, "%s/.xpprc", getenv("HOME"));
  fp = fopen(rc, "r");
  if (fp == NULL) {
    return;
  }
  while (!feof(fp)) {
    bob[0] = '\0';
    fgets(bob, 255, fp);
    if (bob[0] == '@') {
      stor_internopts(bob);
    }
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<check_for_xpprc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
lea    -0x110(%rbp),%rax
mov    %rax,-0x218(%rbp)
lea    0xe7a(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x218(%rbp),%rdi
mov    %rax,%rdx
lea    0xe5a(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11d2 <check_for_xpprc+0x62>
jmp    123b <check_for_xpprc+0xcb>
jmp    11d7 <check_for_xpprc+0x67>
mov    -0x8(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11f5 <check_for_xpprc+0x85>
jmp    1232 <check_for_xpprc+0xc2>
movb   $0x0,-0x210(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xff,%esi
call   1050 <fgets@plt>
movsbl -0x210(%rbp),%eax
cmp    $0x40,%eax
jne    122d <check_for_xpprc+0xbd>
lea    -0x210(%rbp),%rdi
call   1090 <stor_internopts@plt>
jmp    11d7 <check_for_xpprc+0x67>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_for_xpprc>:
push   %r14
push   %rbx
sub    $0x208,%rsp
lea    0xe89(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe73(%rip),%rsi
lea    0x100(%rsp),%rbx
mov    %rbx,%rdi
mov    %rax,%rdx
call   1080 <sprintf@plt>
lea    0xe68(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     11cb <check_for_xpprc+0x5b>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <feof@plt>
test   %eax,%eax
je     11d6 <check_for_xpprc+0x66>
mov    %rbx,%rdi
call   1040 <fclose@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret
mov    %rsp,%r14
jmp    11ec <check_for_xpprc+0x7c>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    11c3 <check_for_xpprc+0x53>
movb   $0x0,(%rsp)
mov    %r14,%rdi
mov    $0xff,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
cmpb   $0x40,(%rsp)
jne    11e0 <check_for_xpprc+0x70>
mov    %r14,%rdi
call   1090 <stor_internopts@plt>
jmp    11e0 <check_for_xpprc+0x70>

LLVM IR (-O0):
@.str = [10 x i8] c"%s/.xpprc\00"
@.str.1 = [5 x i8] c"HOME\00"
@.str.2 = [2 x i8] c"r\00"
define void @check_for_xpprc() {
%1 = alloca i32*
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %8, i32** %1
%9 = load i32*, i32** %1
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %0
br label %34
12: ; preds = %0
br label %13
13: ; preds = %30, %12
%14 = load i32*, i32** %1
%15 = call i32 @feof(i32* %14)
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
br i1 %17, label %18, label %31
18: ; preds = %13
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
store i8 0, i8* %19
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%21 = load i32*, i32** %1
%22 = call i32 @fgets(i8* %20, i32 255, i32* %21)
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 64
br i1 %26, label %27, label %30
27: ; preds = %18
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%29 = call i32 @stor_internopts(i8* %28)
br label %30
30: ; preds = %27, %18
br label %13
31: ; preds = %13
%32 = load i32*, i32** %1
%33 = call i32 @fclose(i32* %32)
br label %34
34: ; preds = %31, %11
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s/.xpprc\00"
@.str.1 = [5 x i8] c"HOME\00"
@.str.2 = [2 x i8] c"r\00"
define void @check_for_xpprc() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32* @fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %23, label %9
9: ; preds = %0
%10 = call i32 @feof(i32* %7)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %9, %18
store i8 0, i8* %4
%13 = call i32 @fgets(i8* %4, i32 255, i32* %7)
%14 = load i8, i8* %4
%15 = icmp eq i8 %14, 64
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @stor_internopts(i8* %4)
br label %18
18: ; preds = %16, %12
%19 = call i32 @feof(i32* %7)
%20 = icmp eq i32 %19, 0
br i1 %20, label %12, label %21
21: ; preds = %18, %9
%22 = call i32 @fclose(i32* %7)
br label %23
23: ; preds = %0, %21
ret void
}