#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*/ *ID0fopen(char *, char *);
int /*<<< orphan*/ log_Printf(int, char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char const *);
FILE *OpenSecret(const char *file) {
  FILE *fp;
  char line[100];
  snprintf(line, sizeof line, "%s/%s", "/etc/ppp", file);
  fp = ID0fopen(line, "r");
  if (fp == NULL)
    log_Printf((23), "OpenSecret: Can't open %s.\n", line);
  return (fp);
}


x86 assembly (clang, -O0):
<OpenSecret>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%r8
mov    $0x64,%esi
lea    0xead(%rip),%rdx
lea    0xeac(%rip),%rcx
call   1040 <snprintf@plt>
lea    -0x80(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1050 <ID0fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1193 <OpenSecret+0x63>
lea    -0x80(%rbp),%rdx
mov    $0x17,%edi
lea    0xe83(%rip),%rsi
call   1030 <log_Printf@plt>
mov    -0x10(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OpenSecret>:
push   %rbx
sub    $0x70,%rsp
mov    %rdi,%r8
lea    0xec1(%rip),%rdx
lea    0xec0(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <snprintf@plt>
lea    0xeb2(%rip),%rsi
mov    %rbx,%rdi
call   1050 <ID0fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1181 <OpenSecret+0x51>
lea    0xe9d(%rip),%rsi
mov    %rsp,%rdx
mov    $0x17,%edi
call   1030 <log_Printf@plt>
mov    %rbx,%rax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%s\00"
@.str.1 = [9 x i8] c"/etc/ppp\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [28 x i8] c"OpenSecret: Can't open %s.\0A\00"
define i32* @OpenSecret(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca [100 x i8]
store i8* %0, i8** %2
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @snprintf(i8* %5, i32 100, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%9 = call i32* @ID0fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %9, i32** %3
%10 = load i32*, i32** %3
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%14 = call i32 @log_Printf(i32 23, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %12, %1
%16 = load i32*, i32** %3
ret i32* %16
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
@.str.1 = [9 x i8] c"/etc/ppp\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [28 x i8] c"OpenSecret: Can't open %s.\0A\00"
define i32* @OpenSecret(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 100, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%5 = call i32* @ID0fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @log_Printf(i32 23, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i8* %3)
br label %9
9: ; preds = %7, %1
ret i32* %5
}