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

/* Variables and functions */
int /*<<< orphan*/ add_log_event(struct tgl_state *, int *, int);
int *alloc_log_event(int);
int /*<<< orphan*/ memcpy(int *, unsigned char *, int);
void bl_do_set_dh_params(struct tgl_state *TLS, int root, unsigned char prime[],
                         int version) {
  int *ev = alloc_log_event(268);
  ev[0] = 0xb6cb184c;
  ev[1] = root;
  memcpy(ev + 2, prime, 256);
  ev[66] = version;
  add_log_event(TLS, ev, 268);
}


x86 assembly (clang, -O0):
<bl_do_set_dh_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    $0x10c,%edi
call   1040 <alloc_log_event@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movl   $0xb6cb184c,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x28(%rbp),%rdi
add    $0x8,%rdi
mov    -0x18(%rbp),%rsi
mov    $0x100,%edx
call   1050 <memcpy@plt>
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,0x108(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x10c,%edx
call   1030 <add_log_event@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bl_do_set_dh_params>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%r12
mov    %esi,%ebp
mov    %rdi,%r15
mov    $0x10c,%edi
call   1040 <alloc_log_event@plt>
mov    %rax,%rbx
movl   $0xb6cb184c,(%rax)
mov    %ebp,0x4(%rax)
lea    0x8(%rax),%rdi
mov    %r12,%rsi
mov    $0x100,%edx
call   1050 <memcpy@plt>
mov    %r14d,0x108(%rbx)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x10c,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <add_log_event@plt>

LLVM IR (-O0):
%struct.tgl_state = type { i32 }
define void @bl_do_set_dh_params(%struct.tgl_state* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca %struct.tgl_state*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
store %struct.tgl_state* %0, %struct.tgl_state** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = call i32* @alloc_log_event(i32 268)
store i32* %10, i32** %9
%11 = load i32*, i32** %9
%12 = getelementptr inbounds i32, i32* %11, i64 0
store i32 -1228203956, i32* %12
%13 = load i32, i32* %6
%14 = load i32*, i32** %9
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32 %13, i32* %15
%16 = load i32*, i32** %9
%17 = getelementptr inbounds i32, i32* %16, i64 2
%18 = load i8*, i8** %7
%19 = call i32 @memcpy(i32* %17, i8* %18, i32 256)
%20 = load i32, i32* %8
%21 = load i32*, i32** %9
%22 = getelementptr inbounds i32, i32* %21, i64 66
store i32 %20, i32* %22
%23 = load %struct.tgl_state*, %struct.tgl_state** %5
%24 = load i32*, i32** %9
%25 = call i32 @add_log_event(%struct.tgl_state* %23, i32* %24, i32 268)
ret void
}

LLVM IR (-O2):
%struct.tgl_state = type { i32 }
define void @bl_do_set_dh_params(%struct.tgl_state* %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32* @alloc_log_event(i32 268)
store i32 -1228203956, i32* %5
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 %1, i32* %6
%7 = getelementptr inbounds i32, i32* %5, i64 2
%8 = tail call i32 @memcpy(i32* %7, i8* %2, i32 256)
%9 = getelementptr inbounds i32, i32* %5, i64 66
store i32 %3, i32* %9
%10 = tail call i32 @add_log_event(%struct.tgl_state* %0, i32* %5, i32 268)
ret void
}