#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*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int main(int argc, char **argv) {
  char buf[80], *p = NULL;
  FILE *f = fopen(argv[1], "r");
  fgets(buf, sizeof buf, f);
  if (buf[8] == 'P')
    if (buf[9] == 'U')
      *p = 5;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x70(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x70(%rbp),%rdx
mov    $0x50,%esi
call   1030 <fgets@plt>
movsbl -0x58(%rbp),%eax
cmp    $0x50,%eax
jne    118e <main+0x6e>
movsbl -0x57(%rbp),%eax
cmp    $0x55,%eax
jne    1189 <main+0x69>
mov    -0x68(%rbp),%rax
movb   $0x5,(%rax)
jmp    118e <main+0x6e>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
mov    0x8(%rsi),%rdi
lea    0xed1(%rip),%rsi
call   1040 <fopen@plt>
mov    %rsp,%rdi
mov    $0x50,%esi
mov    %rax,%rdx
call   1030 <fgets@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
%7 = alloca i8*
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %8
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%14 = load i32*, i32** %8
%15 = call i32 @fgets(i8* %13, i32 80, i32* %14)
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 8
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 80
br i1 %19, label %20, label %28
20: ; preds = %2
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 9
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 85
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = load i8*, i8** %7
store i8 5, i8* %26
br label %27
27: ; preds = %25, %20
br label %28
28: ; preds = %27, %2
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @fgets(i8* %4, i32 80, i32* %7)
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 8
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 80
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 9
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 85
%15 = select i1 %11, i1 true, i1 %14
ret i32 0
}