#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*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ strchr(char const *, char);
int /*<<< orphan*/ strstr(char const *, char const *);
int check_fourcc(const char *fourcc) {
  int ret = 0;
  const char valid_fourcc[] =
      "3IV1 3IV2 8BPS"
      "AASC ABYR ADV1 ADVJ AEMI AFLC AFLI AJPG AMPG ANIM AP41 ASLC"
      "ASV1 ASV2 ASVX AUR2 AURA AVC1 AVRN"
      "BA81 BINK BLZ0 BT20 BTCV BW10 BYR1 BYR2"
      "CC12 CDVC CFCC CGDI CHAM CJPG CMYK CPLA CRAM CSCD CTRX CVID"
      "CWLT CXY1 CXY2 CYUV CYUY"
      "D261 D263 DAVC DCL1 DCL2 DCL3 DCL4 DCL5 DIV3 DIV4 DIV5 DIVX"
      "DM4V DMB1 DMB2 DMK2 DSVD DUCK DV25 DV50 DVAN DVCS DVE2 DVH1"
      "DVHD DVSD DVSL DVX1 DVX2 DVX3 DX50 DXGM DXTC DXTN"
      "EKQ0 ELK0 EM2V ES07 ESCP ETV1 ETV2 ETVC"
      "FFV1 FLJP FMP4 FMVC FPS1 FRWA FRWD FVF1"
      "GEOX GJPG GLZW GPEG GWLT"
      "H260 H261 H262 H263 H264 H265 H266 H267 H268 H269"
      "HDYC HFYU HMCR HMRR"
      "I263 ICLB IGOR IJPG ILVC ILVR IPDV IR21 IRAW ISME"
      "IV30 IV31 IV32 IV33 IV34 IV35 IV36 IV37 IV38 IV39 IV40 IV41"
      "IV41 IV43 IV44 IV45 IV46 IV47 IV48 IV49 IV50"
      "JBYR JPEG JPGL"
      "KMVC"
      "L261 L263 LBYR LCMW LCW2 LEAD LGRY LJ11 LJ22 LJ2K LJ44 LJPG"
      "LMP2 LMP4 LSVC LSVM LSVX LZO1"
      "M261 M263 M4CC M4S2 MC12 MCAM MJ2C MJPG MMES MP2A MP2T MP2V"
      "MP42 MP43 MP4A MP4S MP4T MP4V MPEG MPG4 MPGI MR16 MRCA MRLE"
      "MSVC MSZH"
      "MTX1 MTX2 MTX3 MTX4 MTX5 MTX6 MTX7 MTX8 MTX9"
      "MVI1 MVI2 MWV1"
      "NAVI NDSC NDSM NDSP NDSS NDXC NDXH NDXP NDXS NHVU NTN1 NTN2"
      "NVDS NVHS"
      "NVS0 NVS1 NVS2 NVS3 NVS4 NVS5"
      "NVT0 NVT1 NVT2 NVT3 NVT4 NVT5"
      "PDVC PGVV PHMO PIM1 PIM2 PIMJ PIXL PJPG PVEZ PVMM PVW2"
      "QPEG QPEQ"
      "RGBT RLE RLE4 RLE8 RMP4 RPZA RT21 RV20 RV30 RV40 S422 SAN3"
      "SDCC SEDG SFMC SMP4 SMSC SMSD SMSV SP40 SP44 SP54 SPIG SQZ2"
      "STVA STVB STVC STVX STVY SV10 SVQ1 SVQ3"
      "TLMS TLST TM20 TM2X TMIC TMOT TR20 TSCC TV10 TVJP TVMJ TY0N"
      "TY2C TY2N"
      "UCOD ULTI"
      "V210 V261 V655 VCR1 VCR2 VCR3 VCR4 VCR5 VCR6 VCR7 VCR8 VCR9"
      "VDCT VDOM VDTZ VGPX VIDS VIFP VIVO VIXL VLV1 VP30 VP31 VP40"
      "VP50 VP60 VP61 VP62 VP70 VP80 VQC1 VQC2 VQJC VSSV VUUU VX1K"
      "VX2K VXSP VYU9 VYUY"
      "WBVC WHAM WINX WJPG WMV1 WMV2 WMV3 WMVA WNV1 WVC1"
      "X263 X264 XLV0 XMPG XVID"
      "XWV0 XWV1 XWV2 XWV3 XWV4 XWV5 XWV6 XWV7 XWV8 XWV9"
      "XXAN"
      "Y16 Y411 Y41P Y444 Y8 YC12 YUV8 YUV9 YUVP YUY2 YUYV YV12 YV16"
      "YV92"
      "ZLIB ZMBV ZPEG ZYGO ZYYY";
  if (!fourcc) {
    (void)fputs("fourcc cannot be NULL", stderr);
    return -1;
  }
  if (strchr(fourcc, ' ') || !strstr(valid_fourcc, fourcc))
    ret = 1;
  return ret;
}


x86 assembly (clang, -O0):
<check_fourcc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x750,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x750(%rbp),%rdi
lea    0xe9c(%rip),%rsi
mov    $0x733,%edx
call   1050 <memcpy@plt>
cmpq   $0x0,-0x10(%rbp)
jne    119a <check_fourcc+0x5a>
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
lea    0x15aa(%rip),%rdi
call   1040 <fputs@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d8 <check_fourcc+0x98>
mov    -0x10(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
jne    11cb <check_fourcc+0x8b>
lea    -0x750(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%eax
jne    11d2 <check_fourcc+0x92>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x750,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_fourcc>:
push   %rbx
sub    $0x740,%rsp
mov    %rdi,%rbx
lea    0xeae(%rip),%rsi
mov    %rsp,%rdi
mov    $0x733,%edx
call   1050 <memcpy@plt>
test   %rbx,%rbx
je     1190 <check_fourcc+0x50>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1189 <check_fourcc+0x49>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1060 <strstr@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    11aa <check_fourcc+0x6a>
mov    $0x1,%eax
jmp    11aa <check_fourcc+0x6a>
mov    0x2e49(%rip),%rax
mov    (%rax),%esi
lea    0x1593(%rip),%rdi
call   1040 <fputs@plt>
mov    $0xffffffff,%eax
add    $0x740,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.check_fourcc.valid_fourcc = [1843 x i8] c"3IV1 3IV2 8BPSAASC ABYR ADV1 ADVJ AEMI AFLC AFLI AJPG AMPG ANIM AP41 ASLCASV1 ASV2 ASVX AUR2 AURA AVC1 AVRNBA81 BINK BLZ0 BT20 BTCV BW10 BYR1 BYR2CC12 CDVC CFCC CGDI CHAM CJPG CMYK CPLA CRAM CSCD CTRX CVIDCWLT CXY1 CXY2 CYUV CYUYD261 D263 DAVC DCL1 DCL2 DCL3 DCL4 DCL5 DIV3 DIV4 DIV5 DIVXDM4V DMB1 DMB2 DMK2 DSVD DUCK DV25 DV50 DVAN DVCS DVE2 DVH1DVHD DVSD DVSL DVX1 DVX2 DVX3 DX50 DXGM DXTC DXTNEKQ0 ELK0 EM2V ES07 ESCP ETV1 ETV2 ETVCFFV1 FLJP FMP4 FMVC FPS1 FRWA FRWD FVF1GEOX GJPG GLZW GPEG GWLTH260 H261 H262 H263 H264 H265 H266 H267 H268 H269HDYC HFYU HMCR HMRRI263 ICLB IGOR IJPG ILVC ILVR IPDV IR21 IRAW ISMEIV30 IV31 IV32 IV33 IV34 IV35 IV36 IV37 IV38 IV39 IV40 IV41IV41 IV43 IV44 IV45 IV46 IV47 IV48 IV49 IV50JBYR JPEG JPGLKMVCL261 L263 LBYR LCMW LCW2 LEAD LGRY LJ11 LJ22 LJ2K LJ44 LJPGLMP2 LMP4 LSVC LSVM LSVX LZO1M261 M263 M4CC M4S2 MC12 MCAM MJ2C MJPG MMES MP2A MP2T MP2VMP42 MP43 MP4A MP4S MP4T MP4V MPEG MPG4 MPGI MR16 MRCA MRLEMSVC MSZHMTX1 MTX2 MTX3 MTX4 MTX5 MTX6 MTX7 MTX8 MTX9MVI1 MVI2 MWV1NAVI NDSC NDSM NDSP NDSS NDXC NDXH NDXP NDXS NHVU NTN1 NTN2NVDS NVHSNVS0 NVS1 NVS2 NVS3 NVS4 NVS5NVT0 NVT1 NVT2 NVT3 NVT4 NVT5PDVC PGVV PHMO PIM1 PIM2 PIMJ PIXL PJPG PVEZ PVMM PVW2QPEG QPEQRGBT RLE RLE4 RLE8 RMP4 RPZA RT21 RV20 RV30 RV40 S422 SAN3SDCC SEDG SFMC SMP4 SMSC SMSD SMSV SP40 SP44 SP54 SPIG SQZ2STVA STVB STVC STVX STVY SV10 SVQ1 SVQ3TLMS TLST TM20 TM2X TMIC TMOT TR20 TSCC TV10 TVJP TVMJ TY0NTY2C TY2NUCOD ULTIV210 V261 V655 VCR1 VCR2 VCR3 VCR4 VCR5 VCR6 VCR7 VCR8 VCR9VDCT VDOM VDTZ VGPX VIDS VIFP VIVO VIXL VLV1 VP30 VP31 VP40VP50 VP60 VP61 VP62 VP70 VP80 VQC1 VQC2 VQJC VSSV VUUU VX1KVX2K VXSP VYU9 VYUYWBVC WHAM WINX WJPG WMV1 WMV2 WMV3 WMVA WNV1 WVC1X263 X264 XLV0 XMPG XVIDXWV0 XWV1 XWV2 XWV3 XWV4 XWV5 XWV6 XWV7 XWV8 XWV9XXANY16 Y411 Y41P Y444 Y8 YC12 YUV8 YUV9 YUVP YUY2 YUYV YV12 YV16YV92ZLIB ZMBV ZPEG ZYGO ZYYY\00"
@.str = [22 x i8] c"fourcc cannot be NULL\00"
@stderr = global i32 0
define i32 @check_fourcc(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [1843 x i8]
store i8* %0, i8** %3
store i32 0, i32* %4
%6 = bitcast [1843 x i8]* %5 to i8*
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @fputs(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 -1, i32* %2
br label %24
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = call i64 @strchr(i8* %13, i8 signext 32)
%15 = icmp ne i64 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %12
%17 = getelementptr inbounds [1843 x i8], [1843 x i8]* %5, i64 0, i64 0
%18 = load i8*, i8** %3
%19 = call i32 @strstr(i8* %17, i8* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %16, %12
store i32 1, i32* %4
br label %22
22: ; preds = %21, %16
%23 = load i32, i32* %4
store i32 %23, i32* %2
br label %24
24: ; preds = %22, %9
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@__const.check_fourcc.valid_fourcc = [1843 x i8] c"3IV1 3IV2 8BPSAASC ABYR ADV1 ADVJ AEMI AFLC AFLI AJPG AMPG ANIM AP41 ASLCASV1 ASV2 ASVX AUR2 AURA AVC1 AVRNBA81 BINK BLZ0 BT20 BTCV BW10 BYR1 BYR2CC12 CDVC CFCC CGDI CHAM CJPG CMYK CPLA CRAM CSCD CTRX CVIDCWLT CXY1 CXY2 CYUV CYUYD261 D263 DAVC DCL1 DCL2 DCL3 DCL4 DCL5 DIV3 DIV4 DIV5 DIVXDM4V DMB1 DMB2 DMK2 DSVD DUCK DV25 DV50 DVAN DVCS DVE2 DVH1DVHD DVSD DVSL DVX1 DVX2 DVX3 DX50 DXGM DXTC DXTNEKQ0 ELK0 EM2V ES07 ESCP ETV1 ETV2 ETVCFFV1 FLJP FMP4 FMVC FPS1 FRWA FRWD FVF1GEOX GJPG GLZW GPEG GWLTH260 H261 H262 H263 H264 H265 H266 H267 H268 H269HDYC HFYU HMCR HMRRI263 ICLB IGOR IJPG ILVC ILVR IPDV IR21 IRAW ISMEIV30 IV31 IV32 IV33 IV34 IV35 IV36 IV37 IV38 IV39 IV40 IV41IV41 IV43 IV44 IV45 IV46 IV47 IV48 IV49 IV50JBYR JPEG JPGLKMVCL261 L263 LBYR LCMW LCW2 LEAD LGRY LJ11 LJ22 LJ2K LJ44 LJPGLMP2 LMP4 LSVC LSVM LSVX LZO1M261 M263 M4CC M4S2 MC12 MCAM MJ2C MJPG MMES MP2A MP2T MP2VMP42 MP43 MP4A MP4S MP4T MP4V MPEG MPG4 MPGI MR16 MRCA MRLEMSVC MSZHMTX1 MTX2 MTX3 MTX4 MTX5 MTX6 MTX7 MTX8 MTX9MVI1 MVI2 MWV1NAVI NDSC NDSM NDSP NDSS NDXC NDXH NDXP NDXS NHVU NTN1 NTN2NVDS NVHSNVS0 NVS1 NVS2 NVS3 NVS4 NVS5NVT0 NVT1 NVT2 NVT3 NVT4 NVT5PDVC PGVV PHMO PIM1 PIM2 PIMJ PIXL PJPG PVEZ PVMM PVW2QPEG QPEQRGBT RLE RLE4 RLE8 RMP4 RPZA RT21 RV20 RV30 RV40 S422 SAN3SDCC SEDG SFMC SMP4 SMSC SMSD SMSV SP40 SP44 SP54 SPIG SQZ2STVA STVB STVC STVX STVY SV10 SVQ1 SVQ3TLMS TLST TM20 TM2X TMIC TMOT TR20 TSCC TV10 TVJP TVMJ TY0NTY2C TY2NUCOD ULTIV210 V261 V655 VCR1 VCR2 VCR3 VCR4 VCR5 VCR6 VCR7 VCR8 VCR9VDCT VDOM VDTZ VGPX VIDS VIFP VIVO VIXL VLV1 VP30 VP31 VP40VP50 VP60 VP61 VP62 VP70 VP80 VQC1 VQC2 VQJC VSSV VUUU VX1KVX2K VXSP VYU9 VYUYWBVC WHAM WINX WJPG WMV1 WMV2 WMV3 WMVA WNV1 WVC1X263 X264 XLV0 XMPG XVIDXWV0 XWV1 XWV2 XWV3 XWV4 XWV5 XWV6 XWV7 XWV8 XWV9XXANY16 Y411 Y41P Y444 Y8 YC12 YUV8 YUV9 YUVP YUY2 YUYV YV12 YV16YV92ZLIB ZMBV ZPEG ZYGO ZYYY\00"
@.str = [22 x i8] c"fourcc cannot be NULL\00"
@stderr = global i32 0
define i32 @check_fourcc(i8* %0) {
%2 = alloca [1843 x i8]
%3 = getelementptr inbounds [1843 x i8], [1843 x i8]* %2, i64 0, i64 0
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fputs(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %15
8: ; preds = %1
%9 = tail call i64 @strchr(i8* %0, i8 signext 32)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 @strstr(i8* %3, i8* %0)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11, %8
br label %15
15: ; preds = %11, %14, %5
%16 = phi i32 [ -1, %5 ], [ 1, %14 ], [ 0, %11 ]
ret i32 %16
}