#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 */
scalar_t__ strcmp(char *, char *);
void parse_format(char *format, int *bpp, int *planes) {
  *bpp = 1;
  *planes = 1;
  if ((strcmp(format, "P444") == 0) || (strcmp(format, "IYUV") == 0))
    *planes = 3;
  else if (strcmp(format, "UYVY") == 0)
    *bpp = 2;
  else if (strcmp(format, "I32") == 0)
    *bpp = 4;
  else if (strcmp(format, "16b") == 0)
    *bpp = 2;
  else if (strcmp(format, "32b") == 0)
    *bpp = 4;
  return;
}


x86 assembly (clang, -O0):
<parse_format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     116c <parse_format+0x5c>
mov    -0x8(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    117b <parse_format+0x6b>
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
jmp    122e <parse_format+0x11e>
mov    -0x8(%rbp),%rdi
lea    0xe84(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11a4 <parse_format+0x94>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
jmp    1229 <parse_format+0x119>
mov    -0x8(%rbp),%rdi
lea    0xe60(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11cd <parse_format+0xbd>
mov    -0x10(%rbp),%rax
movl   $0x4,(%rax)
jmp    1224 <parse_format+0x114>
mov    -0x8(%rbp),%rdi
lea    0xe3b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11f6 <parse_format+0xe6>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
jmp    121f <parse_format+0x10f>
mov    -0x8(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    121a <parse_format+0x10a>
mov    -0x10(%rbp),%rax
movl   $0x4,(%rax)
jmp    121f <parse_format+0x10f>
jmp    1224 <parse_format+0x114>
jmp    1229 <parse_format+0x119>
jmp    122e <parse_format+0x11e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_format>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
movl   $0x1,(%rsi)
movl   $0x1,(%rdx)
lea    0xecf(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a8 <parse_format+0x98>
lea    0xec3(%rip),%rsi
mov    %r15,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a8 <parse_format+0x98>
lea    0xeb4(%rip),%rsi
mov    %r15,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b0 <parse_format+0xa0>
lea    0xea5(%rip),%rsi
mov    %r15,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     119f <parse_format+0x8f>
lea    0xe95(%rip),%rsi
mov    %r15,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b0 <parse_format+0xa0>
lea    0xe85(%rip),%rsi
mov    %r15,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    11b7 <parse_format+0xa7>
movl   $0x4,(%r14)
jmp    11b7 <parse_format+0xa7>
movl   $0x3,(%rbx)
jmp    11b7 <parse_format+0xa7>
movl   $0x2,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"P444\00"
@.str.1 = [5 x i8] c"IYUV\00"
@.str.2 = [5 x i8] c"UYVY\00"
@.str.3 = [4 x i8] c"I32\00"
@.str.4 = [4 x i8] c"16b\00"
@.str.5 = [4 x i8] c"32b\00"
define void @parse_format(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %5
store i32 1, i32* %7
%8 = load i32*, i32** %6
store i32 1, i32* %8
%9 = load i8*, i8** %4
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12, %3
%17 = load i32*, i32** %6
store i32 3, i32* %17
br label %46
18: ; preds = %12
%19 = load i8*, i8** %4
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = load i32*, i32** %5
store i32 2, i32* %23
br label %45
24: ; preds = %18
%25 = load i8*, i8** %4
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i32*, i32** %5
store i32 4, i32* %29
br label %44
30: ; preds = %24
%31 = load i8*, i8** %4
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = load i32*, i32** %5
store i32 2, i32* %35
br label %43
36: ; preds = %30
%37 = load i8*, i8** %4
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load i32*, i32** %5
store i32 4, i32* %41
br label %42
42: ; preds = %40, %36
br label %43
43: ; preds = %42, %34
br label %44
44: ; preds = %43, %28
br label %45
45: ; preds = %44, %22
br label %46
46: ; preds = %45, %16
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"P444\00"
@.str.1 = [5 x i8] c"IYUV\00"
@.str.2 = [5 x i8] c"UYVY\00"
@.str.3 = [4 x i8] c"I32\00"
@.str.4 = [4 x i8] c"16b\00"
@.str.5 = [4 x i8] c"32b\00"
define void @parse_format(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
store i32 1, i32* %1
store i32 1, i32* %2
%4 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6, %3
store i32 3, i32* %2
br label %26
10: ; preds = %6
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 2, i32* %1
br label %26
14: ; preds = %10
%15 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 4, i32* %1
br label %26
18: ; preds = %14
%19 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 2, i32* %1
br label %26
22: ; preds = %18
%23 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 4, i32* %1
br label %26
26: ; preds = %13, %21, %25, %22, %17, %9
ret void
}