#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_carr;

/* Variables and functions */
int DFGetImageDimensions(unsigned char *, int, char *, unsigned int *,
                         unsigned int *, char **);
int /*<<< orphan*/ utassert(int, char *);
void test_DFGetImageDimensions_png(void) {
  static unsigned char data_carr[] = {
      0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D,
      0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x0A,
      0x08, 0x03, 0x00, 0x00, 0x00, 0x65, 0xA2, 0x45, 0x90, 0x00, 0x00, 0x00,
      0x2C, 0x74, 0x45, 0x58, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6F,
      0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x00, 0x54, 0x75, 0x65, 0x20, 0x32,
      0x32, 0x20, 0x41, 0x75, 0x67, 0x20, 0x32, 0x30, 0x30, 0x36, 0x20, 0x30,
      0x30, 0x3A, 0x34, 0x33, 0x3A, 0x31, 0x30, 0x20, 0x2D, 0x30, 0x35, 0x30,
      0x30, 0x60, 0x0C, 0x10, 0x58, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4D,
      0x45, 0x07, 0xD6, 0x08, 0x16, 0x05, 0x01, 0x29, 0x10, 0xD3, 0x7D, 0xD6,
      0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x1E, 0xC2,
      0x00, 0x00, 0x1E, 0xC2, 0x01, 0x6E, 0xD0, 0x75, 0x3E, 0x00, 0x00, 0x00,
      0x04, 0x67, 0x41, 0x4D, 0x41, 0x00, 0x00, 0xB1, 0x8F, 0x0B, 0xFC, 0x61,
      0x05, 0x00, 0x00, 0x00, 0x45, 0x50, 0x4C, 0x54, 0x45, 0xFF, 0xFF, 0xFF,
      0xCD, 0xC3, 0xB0, 0xD7, 0xCF, 0xC0, 0x80, 0x66, 0x34, 0x73, 0x57, 0x20,
      0xE1, 0xDB, 0xD0, 0x8A, 0x72, 0x44, 0x60, 0x40, 0x00, 0x62, 0x43, 0x04,
      0xDC, 0xD5, 0xC8, 0xE9, 0xE4, 0xDC, 0x96, 0x81, 0x58, 0x7B, 0x60, 0x2C,
      0xAF, 0x9F, 0x80, 0x6C, 0x4E, 0x14, 0x87, 0x6F, 0x40, 0xF5, 0xF3, 0xF0,
      0xAA, 0x99, 0x78, 0x64, 0x45, 0x08, 0xF0, 0xED, 0xE8, 0x9E, 0x8A, 0x64,
      0xD0, 0xC6, 0xB4, 0x94, 0x7E, 0x54, 0xD6, 0x77, 0xC5, 0x76, 0x00, 0x00,
      0x00, 0x01, 0x74, 0x52, 0x4E, 0x53, 0x00, 0x40, 0xE6, 0xD8, 0x66, 0x00,
      0x00, 0x00, 0x4D, 0x49, 0x44, 0x41, 0x54, 0x78, 0xDA, 0x63, 0x60, 0x40,
      0x01, 0xBC, 0xEC, 0xBC, 0x30, 0x26, 0x2B, 0x9A, 0x08, 0x97, 0x18, 0x1F,
      0x8A, 0x88, 0xB0, 0x08, 0x07, 0xBB, 0x28, 0x92, 0x88, 0x80, 0xA0, 0x10,
      0x3B, 0x3B, 0x0B, 0x2F, 0x04, 0xF0, 0x03, 0x45, 0x58, 0xF9, 0xD8, 0x91,
      0x01, 0x3F, 0x13, 0xD0, 0x0C, 0x6E, 0x20, 0x83, 0x07, 0xAA, 0x86, 0x97,
      0x09, 0x62, 0x0F, 0x1B, 0x3B, 0x07, 0x27, 0xAA, 0x2B, 0x18, 0x98, 0x98,
      0x59, 0x18, 0xD0, 0x01, 0x23, 0x9C, 0x05, 0x00, 0x28, 0x72, 0x03, 0x12,
      0x3C, 0xA3, 0x13, 0x22, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44,
      0xAE, 0x42, 0x60, 0x82};
  static char ext_png[] = "png";
  int rc;
  unsigned int width, height;
  char *errmsg;
  rc = DFGetImageDimensions(data_carr, sizeof(data_carr), ext_png, &width,
                            &height, &errmsg);
  utassert((rc == 1), "wrong rc");
  utassert((width == 17), "wrong width");
  utassert((height == 10), "wrong height");
}


x86 assembly (clang, -O0):
<test_DFGetImageDimensions_png>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0x2f11(%rip),%rdi
mov    $0x154,%esi
lea    0x3059(%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   $0x11,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xe8f(%rip),%rsi
call   1030 <utassert@plt>
cmpl   $0xa,-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_png>:
sub    $0x18,%rsp
lea    0x2f15(%rip),%rdi
lea    0x3062(%rip),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0x10(%rsp),%r9
mov    $0x154,%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   $0x11,0xc(%rsp)
sete   %dil
lea    0xe97(%rip),%rsi
call   1030 <utassert@plt>
xor    %edi,%edi
cmpl   $0xa,0x8(%rsp)
sete   %dil
lea    0xe8c(%rip),%rsi
call   1030 <utassert@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@test_DFGetImageDimensions_png.data_carr = internal global [340 x i8] c"\89PNG\0D\0A\1A\0A\00\00\00\0DIHDR\00\00\00\11\00\00\00\0A\08\03\00\00\00e\A2E\90\00\00\00,tEXtCreation Time\00Tue 22 Aug 2006 00:43:10 -0500`\0C\10X\00\00\00\07tIME\07\D6\08\16\05\01)\10\D3}\D6\00\00\00\09pHYs\00\00\1E\C2\00\00\1E\C2\01n\D0u>\00\00\00\04gAMA\00\00\B1\8F\0B\FCa\05\00\00\00EPLTE\FF\FF\FF\CD\C3\B0\D7\CF\C0\80f4sW \E1\DB\D0\8ArD`@\00bC\04\DC\D5\C8\E9\E4\DC\96\81X{`,\AF\9F\80lN\14\87o@\F5\F3\F0\AA\99xdE\08\F0\ED\E8\9E\8Ad\D0\C6\B4\94~T\D6w\C5v\00\00\00\01tRNS\00@\E6\D8f\00\00\00MIDATx\DAc`@\01\BC\EC\BC0&+\9A\08\97\18\1F\8A\88\B0\08\07\BB(\92\88\80\A0\10;;\0B/\04\F0\03EX\F9\D8\91\01?\13\D0\0Cn \83\07\AA\86\97\09b\0F\1B;\07'\AA+\18\98\98Y\18\D0\01#\9C\05\00(r\03\12<\A3\13\22\00\00\00\00IEND\AEB`\82"
@test_DFGetImageDimensions_png.ext_png = internal global [4 x i8] c"png\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_png() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = call i32 @DFGetImageDimensions(i8* getelementptr inbounds ([340 x i8], [340 x i8]* @test_DFGetImageDimensions_png.data_carr, i64 0, i64 0), i32 340, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @test_DFGetImageDimensions_png.ext_png, 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, 17
%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, 10
%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_png.data_carr = internal global [340 x i8] c"\89PNG\0D\0A\1A\0A\00\00\00\0DIHDR\00\00\00\11\00\00\00\0A\08\03\00\00\00e\A2E\90\00\00\00,tEXtCreation Time\00Tue 22 Aug 2006 00:43:10 -0500`\0C\10X\00\00\00\07tIME\07\D6\08\16\05\01)\10\D3}\D6\00\00\00\09pHYs\00\00\1E\C2\00\00\1E\C2\01n\D0u>\00\00\00\04gAMA\00\00\B1\8F\0B\FCa\05\00\00\00EPLTE\FF\FF\FF\CD\C3\B0\D7\CF\C0\80f4sW \E1\DB\D0\8ArD`@\00bC\04\DC\D5\C8\E9\E4\DC\96\81X{`,\AF\9F\80lN\14\87o@\F5\F3\F0\AA\99xdE\08\F0\ED\E8\9E\8Ad\D0\C6\B4\94~T\D6w\C5v\00\00\00\01tRNS\00@\E6\D8f\00\00\00MIDATx\DAc`@\01\BC\EC\BC0&+\9A\08\97\18\1F\8A\88\B0\08\07\BB(\92\88\80\A0\10;;\0B/\04\F0\03EX\F9\D8\91\01?\13\D0\0Cn \83\07\AA\86\97\09b\0F\1B;\07'\AA+\18\98\98Y\18\D0\01#\9C\05\00(r\03\12<\A3\13\22\00\00\00\00IEND\AEB`\82"
@test_DFGetImageDimensions_png.ext_png = internal global [4 x i8] c"png\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_png() {
%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 ([340 x i8], [340 x i8]* @test_DFGetImageDimensions_png.data_carr, i64 0, i64 0), i32 340, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @test_DFGetImageDimensions_png.ext_png, 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, 17
%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, 10
%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
}