#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 unsigned char frame;

/* Variables and functions */
int /*<<< orphan*/ t32_gen(unsigned char *, int);
int /*<<< orphan*/ t32_seckey(unsigned char *, int);
void t32_genbytes(unsigned long frame, unsigned char *buf, int nbytes) {
  unsigned char framebuf[4];
  framebuf[0] = (frame >> 24) & 0xFF;
  framebuf[1] = (frame >> 16) & 0xFF;
  framebuf[2] = (frame >> 8) & 0xFF;
  framebuf[3] = (frame)&0xFF;
  t32_seckey(framebuf, 4);
  t32_gen(buf, nbytes);
}


x86 assembly (clang, -O0):
<t32_genbytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x18,%rax
and    $0xff,%rax
mov    %al,-0x18(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,-0x17(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,-0x16(%rbp)
mov    -0x8(%rbp),%rax
and    $0xff,%rax
mov    %al,-0x15(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x4,%esi
call   1040 <t32_seckey@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <t32_gen@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t32_genbytes>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
bswap  %edi
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1040 <t32_seckey@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <t32_gen@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @t32_genbytes(i64 %0, i8* %1, i32 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [4 x i8]
store i64 %0, i64* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i64, i64* %4
%9 = lshr i64 %8, 24
%10 = and i64 %9, 255
%11 = trunc i64 %10 to i8
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
store i8 %11, i8* %12
%13 = load i64, i64* %4
%14 = lshr i64 %13, 16
%15 = and i64 %14, 255
%16 = trunc i64 %15 to i8
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 1
store i8 %16, i8* %17
%18 = load i64, i64* %4
%19 = lshr i64 %18, 8
%20 = and i64 %19, 255
%21 = trunc i64 %20 to i8
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 2
store i8 %21, i8* %22
%23 = load i64, i64* %4
%24 = and i64 %23, 255
%25 = trunc i64 %24 to i8
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 3
store i8 %25, i8* %26
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%28 = call i32 @t32_seckey(i8* %27, i32 4)
%29 = load i8*, i8** %5
%30 = load i32, i32* %6
%31 = call i32 @t32_gen(i8* %29, i32 %30)
ret void
}

LLVM IR (-O2):
define void @t32_genbytes(i64 %0, i8* %1, i32 %2) {
%4 = alloca [4 x i8]
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%6 = lshr i64 %0, 24
%7 = trunc i64 %6 to i8
store i8 %7, i8* %5
%8 = lshr i64 %0, 16
%9 = trunc i64 %8 to i8
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 1
store i8 %9, i8* %10
%11 = lshr i64 %0, 8
%12 = trunc i64 %11 to i8
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 2
store i8 %12, i8* %13
%14 = trunc i64 %0 to i8
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 3
store i8 %14, i8* %15
%16 = call i32 @t32_seckey(i8* %5, i32 4)
%17 = call i32 @t32_gen(i8* %1, i32 %2)
ret void
}