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

/* Variables and functions */
int rtp2435_get_q(int *);
int *rtp2435_restart(int *);
uint8_t *rtp2435_quantization_table(uint8_t *header) {
  uint8_t q = rtp2435_get_q(header);
  if (128 <= q) {
    uint8_t *p;
    if ((p = rtp2435_restart(header)))
      return p + 4;
    else
      return header + 8;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<rtp2435_quantization_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <rtp2435_get_q@plt>
mov    %eax,-0x14(%rbp)
mov    $0x80,%eax
cmp    -0x14(%rbp),%eax
jg     117f <rtp2435_quantization_table+0x5f>
mov    -0x10(%rbp),%rdi
call   1030 <rtp2435_restart@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     116e <rtp2435_quantization_table+0x4e>
mov    -0x20(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
jmp    1187 <rtp2435_quantization_table+0x67>
mov    -0x10(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x8(%rbp)
jmp    1187 <rtp2435_quantization_table+0x67>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtp2435_quantization_table>:
push   %rbx
mov    %rdi,%rbx
call   1040 <rtp2435_get_q@plt>
cmp    $0x80,%eax
jl     1149 <rtp2435_quantization_table+0x29>
mov    %rbx,%rdi
call   1030 <rtp2435_restart@plt>
lea    0x10(%rax),%rcx
add    $0x20,%rbx
test   %rax,%rax
cmovne %rcx,%rbx
jmp    114b <rtp2435_quantization_table+0x2b>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i32* @rtp2435_quantization_table(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
store i32* %0, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 @rtp2435_get_q(i32* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp sle i32 128, %8
br i1 %9, label %10, label %20
10: ; preds = %1
%11 = load i32*, i32** %3
%12 = call i32* @rtp2435_restart(i32* %11)
store i32* %12, i32** %5
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i64 4
store i32* %16, i32** %2
br label %21
17: ; preds = %10
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 8
store i32* %19, i32** %2
br label %21
20: ; preds = %1
store i32* null, i32** %2
br label %21
21: ; preds = %20, %17, %14
%22 = load i32*, i32** %2
ret i32* %22
}

LLVM IR (-O2):
define i32* @rtp2435_quantization_table(i32* %0) {
%2 = tail call i32 @rtp2435_get_q(i32* %0)
%3 = icmp sgt i32 %2, 127
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = tail call i32* @rtp2435_restart(i32* %0)
%6 = icmp eq i32* %5, null
%7 = getelementptr inbounds i32, i32* %5, i64 4
%8 = getelementptr inbounds i32, i32* %0, i64 8
%9 = select i1 %6, i32* %8, i32* %7
br label %10
10: ; preds = %1, %4
%11 = phi i32* [ %9, %4 ], [ null, %1 ]
ret i32* %11
}