#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*/ SEEK_END;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
char *detect_steg(FILE *f) {
  fseek(f, -2, SEEK_END);
  if (fgetc(f) != 255 || fgetc(f) != 217)
    return "Possible Steganography (Hidden Files Embedded in an Image)";
  return NULL;
}


x86 assembly (clang, -O0):
<detect_steg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffffe,%esi
call   1040 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
cmp    $0xff,%eax
jne    116b <detect_steg+0x4b>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
cmp    $0xd9,%eax
je     117b <detect_steg+0x5b>
lea    0xe8e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1183 <detect_steg+0x63>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detect_steg>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ebd(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffffe,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xff,%eax
jne    1165 <detect_steg+0x45>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xd9,%ecx
lea    0xea1(%rip),%rcx
cmovne %rcx,%rax
pop    %rbx
ret
lea    0xe94(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@.str = [59 x i8] c"Possible Steganography (Hidden Files Embedded in an Image)\00"
define i8* @detect_steg(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* @SEEK_END
%6 = call i32 @fseek(i32* %4, i32 -2, i32 %5)
%7 = load i32*, i32** %3
%8 = call i32 @fgetc(i32* %7)
%9 = icmp ne i32 %8, 255
br i1 %9, label %14, label %10
10: ; preds = %1
%11 = load i32*, i32** %3
%12 = call i32 @fgetc(i32* %11)
%13 = icmp ne i32 %12, 217
br i1 %13, label %14, label %15
14: ; preds = %10, %1
store i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
15: ; preds = %10
store i8* null, i8** %2
br label %16
16: ; preds = %15, %14
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@.str = [59 x i8] c"Possible Steganography (Hidden Files Embedded in an Image)\00"
define i8* @detect_steg(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32* %0, i32 -2, i32 %2)
%4 = tail call i32 @fgetc(i32* %0)
%5 = icmp eq i32 %4, 255
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = tail call i32 @fgetc(i32* %0)
%8 = icmp eq i32 %7, 217
%9 = select i1 %8, i8* null, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0)
br label %10
10: ; preds = %6, %1
%11 = phi i8* [ getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), %1 ], [ %9, %6 ]
ret i8* %11
}