#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 */
struct carousel {
  int dummy;
};

/* Variables and functions */
int read_dsmcc_tables(struct carousel *, unsigned char *);
int /*<<< orphan*/ verbose(char *);
int read_dsi_dii_tables(struct carousel *car, unsigned char *buffer) {
  int found = 0;
  int result = 0;
  while (!found) {
    result = read_dsmcc_tables(car, buffer);
    if (result > 0) {
      if (buffer[0] & 0x3B) {
        found = 1;
      }
    } else {
      found = 1;
    }
  }
  verbose("reading dsi dii table done\n");
  return result;
}


x86 assembly (clang, -O0):
<read_dsi_dii_tables>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1154 <read_dsi_dii_tables+0x34>
jmp    1199 <read_dsi_dii_tables+0x79>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <read_dsmcc_tables@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    118d <read_dsi_dii_tables+0x6d>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
and    $0x3b,%eax
cmp    $0x0,%eax
je     1188 <read_dsi_dii_tables+0x68>
movl   $0x1,-0x14(%rbp)
jmp    1194 <read_dsi_dii_tables+0x74>
movl   $0x1,-0x14(%rbp)
jmp    113e <read_dsi_dii_tables+0x1e>
lea    0xe60(%rip),%rdi
call   1040 <verbose@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_dsi_dii_tables>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <read_dsmcc_tables@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    1146 <read_dsi_dii_tables+0x26>
testb  $0x3b,(%rbx)
je     1130 <read_dsi_dii_tables+0x10>
lea    0xeb3(%rip),%rdi
call   1040 <verbose@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.carousel = type { i32 }
@.str = [28 x i8] c"reading dsi dii table done\0A\00"
define i32 @read_dsi_dii_tables(%struct.carousel* %0, i8* %1) {
%3 = alloca %struct.carousel*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store %struct.carousel* %0, %struct.carousel** %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %27, %2
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %28
11: ; preds = %7
%12 = load %struct.carousel*, %struct.carousel** %3
%13 = load i8*, i8** %4
%14 = call i32 @read_dsmcc_tables(%struct.carousel* %12, i8* %13)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %26
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = and i32 %21, 59
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %17
store i32 1, i32* %5
br label %25
25: ; preds = %24, %17
br label %27
26: ; preds = %11
store i32 1, i32* %5
br label %27
27: ; preds = %26, %25
br label %7
28: ; preds = %7
%29 = call i32 @verbose(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%30 = load i32, i32* %6
ret i32 %30
}

LLVM IR (-O2):
%struct.carousel = type { i32 }
@.str = [28 x i8] c"reading dsi dii table done\0A\00"
define i32 @read_dsi_dii_tables(%struct.carousel* %0, i8* %1) {
br label %3
3: ; preds = %2, %6
%4 = tail call i32 @read_dsmcc_tables(%struct.carousel* %0, i8* %1)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i8, i8* %1
%8 = and i8 %7, 59
%9 = icmp eq i8 %8, 0
br i1 %9, label %3, label %10
10: ; preds = %3, %6
%11 = tail call i32 @verbose(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}