#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*/ data_banner;

/* Variables and functions */
int DFGetImageDimensions(unsigned char *, int, char *, unsigned int *,
                         unsigned int *, char **);
int /*<<< orphan*/ utassert(int, char *);
void test_DFGetImageDimensions_jpg(void) {
  static unsigned char data_banner[] = {
      0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01,
      0x01, 0x01, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x13,
      0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68,
      0x20, 0x47, 0x49, 0x4D, 0x50, 0xFF, 0xDB, 0x00, 0x43, 0x00, 0x05, 0x03,
      0x04, 0x04, 0x04, 0x03, 0x05, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x06,
      0x07, 0x0C, 0x08, 0x07, 0x07, 0x07, 0x07, 0x0F, 0x0B, 0x0B, 0x09, 0x0C,
      0x11, 0x0F, 0x12, 0x12, 0x11, 0x0F, 0x11, 0x11, 0x13, 0x16, 0x1C, 0x17,
      0x13, 0x14, 0x1A, 0x15, 0x11, 0x11, 0x18, 0x21, 0x18, 0x1A, 0x1D, 0x1D,
      0x1F, 0x1F, 0x1F, 0x13, 0x17, 0x22, 0x24, 0x22, 0x1E, 0x24, 0x1C, 0x1E,
      0x1F, 0x1E, 0xFF, 0xDB, 0x00, 0x43, 0x01, 0x05, 0x05, 0x05, 0x07, 0x06,
      0x07, 0x0E, 0x08, 0x08, 0x0E, 0x1E, 0x14, 0x11, 0x14, 0x1E, 0x1E, 0x1E,
      0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E,
      0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E,
      0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E,
      0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0xFF,
      0xC0, 0x00, 0x11, 0x08, 0x00, 0x64, 0x00, 0x02, 0x03, 0x01, 0x22, 0x00,
      0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xFF, 0xC4, 0x00, 0x17, 0x00, 0x01,
      0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x08, 0xFF, 0xC4, 0x00, 0x1B, 0x10,
      0x01, 0x00, 0x02, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x03, 0x11, 0x13, 0x32, 0x52,
      0xFF, 0xC4, 0x00, 0x14, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xC4,
      0x00, 0x14, 0x11, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xDA, 0x00, 0x0C,
      0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3F, 0x00, 0xD9, 0x60,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0xE7, 0xC5, 0xEE, 0x00,
      0x52, 0x66, 0xE5, 0x8D, 0xF7, 0x00, 0x1F, 0xFF, 0xD9};
  static char ext_jpg[] = "jpg";
  int rc;
  unsigned int width, height;
  char *errmsg;
  rc = DFGetImageDimensions(data_banner, sizeof(data_banner), ext_jpg, &width,
                            &height, &errmsg);
  utassert((rc == 1), "wrong rc");
  utassert((width == 2), "wrong width");
  utassert((height == 100), "wrong height");
}


x86 assembly (clang, -O0):
<test_DFGetImageDimensions_jpg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0x2f11(%rip),%rdi
mov    $0x14d,%esi
lea    0x3052(%rip),%rdx
lea    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%r8
lea    -0x18(%rbp),%r9
call   1040 <DFGetImageDimensions@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe9e(%rip),%rsi
call   1030 <utassert@plt>
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe8f(%rip),%rsi
call   1030 <utassert@plt>
cmpl   $0x64,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe83(%rip),%rsi
call   1030 <utassert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_DFGetImageDimensions_jpg>:
sub    $0x18,%rsp
lea    0x2f15(%rip),%rdi
lea    0x305b(%rip),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0x10(%rsp),%r9
mov    $0x14d,%esi
call   1040 <DFGetImageDimensions@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
lea    0xea5(%rip),%rsi
call   1030 <utassert@plt>
xor    %edi,%edi
cmpl   $0x2,0xc(%rsp)
sete   %dil
lea    0xe97(%rip),%rsi
call   1030 <utassert@plt>
xor    %edi,%edi
cmpl   $0x64,0x8(%rsp)
sete   %dil
lea    0xe8c(%rip),%rsi
call   1030 <utassert@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@test_DFGetImageDimensions_jpg.data_banner = internal global [333 x i8] c"\FF\D8\FF\E0\00\10JFIF\00\01\01\01\00H\00H\00\00\FF\FE\00\13Created with GIMP\FF\DB\00C\00\05\03\04\04\04\03\05\04\04\04\05\05\05\06\07\0C\08\07\07\07\07\0F\0B\0B\09\0C\11\0F\12\12\11\0F\11\11\13\16\1C\17\13\14\1A\15\11\11\18!\18\1A\1D\1D\1F\1F\1F\13\17\22$\22\1E$\1C\1E\1F\1E\FF\DB\00C\01\05\05\05\07\06\07\0E\08\08\0E\1E\14\11\14\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\FF\C0\00\11\08\00d\00\02\03\01\22\00\02\11\01\03\11\01\FF\C4\00\17\00\01\00\03\00\00\00\00\00\00\00\00\00\00\00\00\00\00\03\06\08\FF\C4\00\1B\10\01\00\02\02\03\00\00\00\00\00\00\00\00\00\00\00\00\01\04\03\11\132R\FF\C4\00\14\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\C4\00\14\11\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\DA\00\0C\03\01\00\02\11\03\11\00?\00\D9`\00\00\00\00\00\00\00#\E7\C5\EE\00Rf\E5\8D\F7\00\1F\FF\D9"
@test_DFGetImageDimensions_jpg.ext_jpg = internal global [4 x i8] c"jpg\00"
@.str = [9 x i8] c"wrong rc\00"
@.str.1 = [12 x i8] c"wrong width\00"
@.str.2 = [13 x i8] c"wrong height\00"
define void @test_DFGetImageDimensions_jpg() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = call i32 @DFGetImageDimensions(i8* getelementptr inbounds ([333 x i8], [333 x i8]* @test_DFGetImageDimensions_jpg.data_banner, i64 0, i64 0), i32 333, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @test_DFGetImageDimensions_jpg.ext_jpg, i64 0, i64 0), i32* %2, i32* %3, i8** %4)
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = call i32 @utassert(i32 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 2
%12 = zext i1 %11 to i32
%13 = call i32 @utassert(i32 %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 100
%16 = zext i1 %15 to i32
%17 = call i32 @utassert(i32 %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@test_DFGetImageDimensions_jpg.data_banner = internal global [333 x i8] c"\FF\D8\FF\E0\00\10JFIF\00\01\01\01\00H\00H\00\00\FF\FE\00\13Created with GIMP\FF\DB\00C\00\05\03\04\04\04\03\05\04\04\04\05\05\05\06\07\0C\08\07\07\07\07\0F\0B\0B\09\0C\11\0F\12\12\11\0F\11\11\13\16\1C\17\13\14\1A\15\11\11\18!\18\1A\1D\1D\1F\1F\1F\13\17\22$\22\1E$\1C\1E\1F\1E\FF\DB\00C\01\05\05\05\07\06\07\0E\08\08\0E\1E\14\11\14\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\1E\FF\C0\00\11\08\00d\00\02\03\01\22\00\02\11\01\03\11\01\FF\C4\00\17\00\01\00\03\00\00\00\00\00\00\00\00\00\00\00\00\00\00\03\06\08\FF\C4\00\1B\10\01\00\02\02\03\00\00\00\00\00\00\00\00\00\00\00\00\01\04\03\11\132R\FF\C4\00\14\01\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\C4\00\14\11\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\FF\DA\00\0C\03\01\00\02\11\03\11\00?\00\D9`\00\00\00\00\00\00\00#\E7\C5\EE\00Rf\E5\8D\F7\00\1F\FF\D9"
@test_DFGetImageDimensions_jpg.ext_jpg = internal global [4 x i8] c"jpg\00"
@.str = [9 x i8] c"wrong rc\00"
@.str.1 = [12 x i8] c"wrong width\00"
@.str.2 = [13 x i8] c"wrong height\00"
define void @test_DFGetImageDimensions_jpg() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i8** %3 to i8*
%7 = call i32 @DFGetImageDimensions(i8* getelementptr inbounds ([333 x i8], [333 x i8]* @test_DFGetImageDimensions_jpg.data_banner, i64 0, i64 0), i32 333, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @test_DFGetImageDimensions_jpg.ext_jpg, i64 0, i64 0), i32* %1, i32* %2, i8** %3)
%8 = icmp eq i32 %7, 1
%9 = zext i1 %8 to i32
%10 = call i32 @utassert(i32 %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 2
%13 = zext i1 %12 to i32
%14 = call i32 @utassert(i32 %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 100
%17 = zext i1 %16 to i32
%18 = call i32 @utassert(i32 %17, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
ret void
}