#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 */

/* Variables and functions */
int EVP_MAX_MD_SIZE;
int /*<<< orphan*/ EVP_sha1();
int /*<<< orphan*/ HMAC(int /*<<< orphan*/, char const *, size_t const,
                        unsigned char *, size_t const, unsigned char *,
                        unsigned int *);
char *oauth_encode_base64(unsigned int, unsigned char *);
char *oauth_sign_hmac_sha1_raw(const char *m, const size_t ml, const char *k,
                               const size_t kl) {
  unsigned char result[EVP_MAX_MD_SIZE];
  unsigned int resultlen = 0;
  HMAC(EVP_sha1(), k, kl, (unsigned char *)m, ml, result, &resultlen);
  return (oauth_encode_base64(resultlen, result));
}


x86 assembly (clang, -O0):
<oauth_sign_hmac_sha1_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    $0x0,%al
call   1030 <EVP_sha1@plt>
mov    -0x40(%rbp),%r9
mov    %eax,%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    -0x34(%rbp),%rax
sub    $0x10,%rsp
mov    %rax,(%rsp)
call   1040 <HMAC@plt>
mov    -0x40(%rbp),%rsi
add    $0x10,%rsp
mov    -0x34(%rbp),%edi
call   1050 <oauth_encode_base64@plt>
mov    -0x28(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oauth_sign_hmac_sha1_raw>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%r12
mov    0x2e97(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
movl   $0x0,-0x2c(%rbp)
xor    %eax,%eax
call   1030 <EVP_sha1@plt>
sub    $0x8,%rsp
lea    -0x2c(%rbp),%r10
mov    %eax,%edi
mov    %r13,%rsi
mov    %r14,%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    %rbx,%r9
push   %r10
call   1040 <HMAC@plt>
add    $0x10,%rsp
mov    -0x2c(%rbp),%edi
mov    %rbx,%rsi
call   1050 <oauth_encode_base64@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EVP_MAX_MD_SIZE = global i32 0
define i8* @oauth_sign_hmac_sha1_raw(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%12 = load i32, i32* @EVP_MAX_MD_SIZE
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %9
%15 = alloca i8, i64 %13
store i64 %13, i64* %10
store i32 0, i32* %11
%16 = call i32 (...) @EVP_sha1()
%17 = load i8*, i8** %7
%18 = load i64, i64* %8
%19 = load i8*, i8** %5
%20 = load i64, i64* %6
%21 = call i32 @HMAC(i32 %16, i8* %17, i64 %18, i8* %19, i64 %20, i8* %15, i32* %11)
%22 = load i32, i32* %11
%23 = call i8* @oauth_encode_base64(i32 %22, i8* %15)
%24 = load i8*, i8** %9
ret i8* %23
}

LLVM IR (-O2):
@EVP_MAX_MD_SIZE = global i32 0
define i8* @oauth_sign_hmac_sha1_raw(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = load i32, i32* @EVP_MAX_MD_SIZE
%7 = zext i32 %6 to i64
%8 = alloca i8, i64 %7
%9 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = tail call i32 (...) @EVP_sha1()
%11 = call i32 @HMAC(i32 %10, i8* %2, i64 %3, i8* %0, i64 %1, i8* %8, i32* %5)
%12 = load i32, i32* %5
%13 = call i8* @oauth_encode_base64(i32 %12, i8* %8)
ret i8* %13
}