#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 union ig_table_cmd_u {
  int dummy;
} ig_table_cmd_u;

/* Variables and functions */
int /*<<< orphan*/ ig_table_cmd_set(unsigned int, union ig_table_cmd_u *);
int /*<<< orphan*/ ingress_reg_tbl_get(unsigned int, int, unsigned int *,
                                       unsigned int);
int ig_indirect_table_get(unsigned int dev_id, unsigned int table_type,
                          unsigned int index, unsigned int entry_len,
                          unsigned int *pentry) {
  unsigned int cmd = 0;
  cmd = (0x1 << 30) | (table_type << 12) | index;
  ig_table_cmd_set(dev_id, (union ig_table_cmd_u *)&cmd);
  ingress_reg_tbl_get(dev_id, 0x140, pentry, entry_len);
  return 0;
}


x86 assembly (clang, -O0):
<ig_indirect_table_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
shl    $0xc,%eax
or     $0x40000000,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x1c(%rbp),%rsi
call   1030 <ig_table_cmd_set@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%ecx
mov    $0x140,%esi
call   1040 <ingress_reg_tbl_get@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ig_indirect_table_get>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %r8,%r14
mov    %ecx,%ebp
mov    %edi,%ebx
shl    $0xc,%esi
or     %edx,%esi
or     $0x40000000,%esi
mov    %esi,0xc(%rsp)
lea    0xc(%rsp),%rsi
call   1030 <ig_table_cmd_set@plt>
mov    %ebx,%edi
mov    $0x140,%esi
mov    %r14,%rdx
mov    %ebp,%ecx
call   1040 <ingress_reg_tbl_get@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%union.ig_table_cmd_u = type { i32 }
define i32 @ig_indirect_table_get(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32* %4, i32** %10
store i32 0, i32* %11
%12 = load i32, i32* %7
%13 = shl i32 %12, 12
%14 = or i32 1073741824, %13
%15 = load i32, i32* %8
%16 = or i32 %14, %15
store i32 %16, i32* %11
%17 = load i32, i32* %6
%18 = bitcast i32* %11 to %union.ig_table_cmd_u*
%19 = call i32 @ig_table_cmd_set(i32 %17, %union.ig_table_cmd_u* %18)
%20 = load i32, i32* %6
%21 = load i32*, i32** %10
%22 = load i32, i32* %9
%23 = call i32 @ingress_reg_tbl_get(i32 %20, i32 320, i32* %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
%union.ig_table_cmd_u = type { i32 }
define i32 @ig_indirect_table_get(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = bitcast i32* %6 to i8*
%8 = shl i32 %1, 12
%9 = or i32 %8, %2
%10 = or i32 %9, 1073741824
store i32 %10, i32* %6
%11 = bitcast i32* %6 to %union.ig_table_cmd_u*
%12 = call i32 @ig_table_cmd_set(i32 %0, %union.ig_table_cmd_u* %11)
%13 = call i32 @ingress_reg_tbl_get(i32 %0, i32 320, i32* %4, i32 %3)
ret i32 0
}