#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*/ strcasecmp(char const *, char *);
scalar_t__ strcmp(char const *, char const *);
int jpeg_filter(const char *filename, const char *extname, void *cbarg) {
  const char *output = cbarg;
  if (strcmp(output, filename) && extname &&
      (!strcasecmp(extname, "jpg") || !strcasecmp(extname, "jpeg"))) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<jpeg_filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     119c <jpeg_filter+0x7c>
cmpq   $0x0,-0x18(%rbp)
je     119c <jpeg_filter+0x7c>
mov    -0x18(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     1190 <jpeg_filter+0x70>
mov    -0x18(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    119c <jpeg_filter+0x7c>
movl   $0x1,-0x4(%rbp)
jmp    11a3 <jpeg_filter+0x83>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jpeg_filter>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    %rdx,%rdi
call   1040 <strcmp@plt>
test   %rbx,%rbx
je     1166 <jpeg_filter+0x46>
test   %rax,%rax
je     1166 <jpeg_filter+0x46>
lea    0xebe(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1168 <jpeg_filter+0x48>
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1168 <jpeg_filter+0x48>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"jpg\00"
@.str.1 = [5 x i8] c"jpeg\00"
define i32 @jpeg_filter(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @strcmp(i8* %2, i8* %0)
%5 = icmp ne i64 %4, 0
%6 = icmp ne i8* %1, null
%7 = and i1 %6, %5
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = tail call i32 @strcasecmp(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @strcasecmp(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %11, %3
br label %15
15: ; preds = %8, %11, %14
%16 = phi i32 [ 0, %14 ], [ 1, %11 ], [ 1, %8 ]
ret i32 %16
}