#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;
typedef int /*<<< orphan*/ uint16_t;
struct ts_nit {
  int dummy;
};

/* Variables and functions */
int *calloc(int, int);
int ts_nit_add_stream(struct ts_nit *, int /*<<< orphan*/, int /*<<< orphan*/,
                      int *, int);
int ts_nit_add_nordig_specifier_descriptor(struct ts_nit *nit, uint16_t ts_id,
                                           uint16_t org_net_id) {
  int desc_size = 2 + 4;
  uint8_t *desc = calloc(1, desc_size);
  int dpos = 0;
  desc[dpos + 0] = 0x5f;
  desc[dpos + 1] = desc_size - 2;
  desc[dpos + 2] = 0x00;
  desc[dpos + 3] = 0x00;
  desc[dpos + 4] = 0x00;
  desc[dpos + 5] = 0x29;
  return ts_nit_add_stream(nit, ts_id, org_net_id, desc, desc_size);
}


x86 assembly (clang, -O0):
<ts_nit_add_nordig_specifier_descriptor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x6,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movl   $0x5f,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
sub    $0x2,%edx
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
movl   $0x29,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x14(%rbp),%r8d
call   1040 <ts_nit_add_stream@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_nit_add_nordig_specifier_descriptor>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x1,%edi
mov    $0x6,%esi
call   1030 <calloc@plt>
movaps 0xebe(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x2900000000,%rcx
mov    %rcx,0x10(%rax)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %rax,%rcx
mov    $0x6,%r8d
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <ts_nit_add_stream@plt>

LLVM IR (-O0):
%struct.ts_nit = type { i32 }
define i32 @ts_nit_add_nordig_specifier_descriptor(%struct.ts_nit* %0, i32 %1, i32 %2) {
%4 = alloca %struct.ts_nit*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store %struct.ts_nit* %0, %struct.ts_nit** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 6, i32* %7
%10 = load i32, i32* %7
%11 = call i32* @calloc(i32 1, i32 %10)
store i32* %11, i32** %8
store i32 0, i32* %9
%12 = load i32*, i32** %8
%13 = load i32, i32* %9
%14 = add nsw i32 %13, 0
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %12, i64 %15
store i32 95, i32* %16
%17 = load i32, i32* %7
%18 = sub nsw i32 %17, 2
%19 = load i32*, i32** %8
%20 = load i32, i32* %9
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %19, i64 %22
store i32 %18, i32* %23
%24 = load i32*, i32** %8
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %24, i64 %27
store i32 0, i32* %28
%29 = load i32*, i32** %8
%30 = load i32, i32* %9
%31 = add nsw i32 %30, 3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %29, i64 %32
store i32 0, i32* %33
%34 = load i32*, i32** %8
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %34, i64 %37
store i32 0, i32* %38
%39 = load i32*, i32** %8
%40 = load i32, i32* %9
%41 = add nsw i32 %40, 5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %39, i64 %42
store i32 41, i32* %43
%44 = load %struct.ts_nit*, %struct.ts_nit** %4
%45 = load i32, i32* %5
%46 = load i32, i32* %6
%47 = load i32*, i32** %8
%48 = load i32, i32* %7
%49 = call i32 @ts_nit_add_stream(%struct.ts_nit* %44, i32 %45, i32 %46, i32* %47, i32 %48)
ret i32 %49
}

LLVM IR (-O2):
%struct.ts_nit = type { i32 }
define i32 @ts_nit_add_nordig_specifier_descriptor(%struct.ts_nit* %0, i32 %1, i32 %2) {
%4 = tail call i32* @calloc(i32 1, i32 6)
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 95, i32 4, i32 0, i32 0>, <4 x i32>* %5
%6 = getelementptr inbounds i32, i32* %4, i64 4
store i32 0, i32* %6
%7 = getelementptr inbounds i32, i32* %4, i64 5
store i32 41, i32* %7
%8 = tail call i32 @ts_nit_add_stream(%struct.ts_nit* %0, i32 %1, i32 %2, i32* %4, i32 6)
ret i32 %8
}