#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 /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
void signature(const char *rpmPath, const char *Signature) {
  FILE *fptr = NULL;
  fptr = fopen(rpmPath, "ab");
  if (fptr == NULL)
    goto exit;
  char buf[] = {
      0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
      0x00, 0x00, 0x10, 0x54, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x07,
      0x00, 0x00, 0x10, 0x44, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x0d,
      0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
      0x00, 0x00, 0x03, 0xec, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x30,
      0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x03, 0xef, 0x00, 0x00, 0x00, 0x04,
      0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0xf0,
      0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x10, 0x00};
  fwrite(buf, sizeof(buf), 1, fptr);
  fflush(fptr);
exit:
  if (fptr) {
    fclose(fptr);
    fptr = NULL;
  }
}


x86 assembly (clang, -O0):
<signature>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118f <signature+0x3f>
jmp    11c4 <signature+0x74>
lea    -0x80(%rbp),%rdi
lea    0xe76(%rip),%rsi
mov    $0x60,%edx
call   1040 <memcpy@plt>
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x60,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fflush@plt>
cmpq   $0x0,-0x18(%rbp)
je     11e0 <signature+0x90>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movq   $0x0,-0x18(%rbp)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signature>:
push   %rbx
sub    $0x60,%rsp
lea    0xeb4(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     11ca <signature+0x8a>
mov    %rax,%rbx
movaps 0xf00(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe90(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe74(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x60,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
call   1040 <fflush@plt>
mov    %rbx,%rdi
add    $0x60,%rsp
pop    %rbx
jmp    1030 <fclose@plt>
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"ab\00"
@__const.signature.buf = [96 x i8] c"\8E\AD\E8\01\00\00\00\00\00\00\00\06\00\00\10T\00\00\00>\00\00\00\07\00\00\10D\00\00\00\10\00\00\01\0D\00\00\00\06\00\00\00\00\00\00\00\01\00\00\03\EC\00\00\00\07\00\00\000\00\00\00\10\00\00\03\EF\00\00\00\04\00\00\00@\00\00\00\01\00\00\03\F0\00\00\00\07\00\00\00D\00\00\10\00"
define void @signature(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca [96 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32* null, i32** %5
%7 = load i8*, i8** %3
%8 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
br label %19
12: ; preds = %2
%13 = bitcast [96 x i8]* %6 to i8*
%14 = getelementptr inbounds [96 x i8], [96 x i8]* %6, i64 0, i64 0
%15 = load i32*, i32** %5
%16 = call i32 @fwrite(i8* %14, i32 96, i32 1, i32* %15)
%17 = load i32*, i32** %5
%18 = call i32 @fflush(i32* %17)
br label %19
19: ; preds = %12, %11
%20 = load i32*, i32** %5
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32*, i32** %5
%24 = call i32 @fclose(i32* %23)
store i32* null, i32** %5
br label %25
25: ; preds = %22, %19
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"ab\00"
@__const.signature.buf = [96 x i8] c"\8E\AD\E8\01\00\00\00\00\00\00\00\06\00\00\10T\00\00\00>\00\00\00\07\00\00\10D\00\00\00\10\00\00\01\0D\00\00\00\06\00\00\00\00\00\00\00\01\00\00\03\EC\00\00\00\07\00\00\000\00\00\00\10\00\00\03\EF\00\00\00\04\00\00\00@\00\00\00\01\00\00\03\F0\00\00\00\07\00\00\00D\00\00\10\00"
define void @signature(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = alloca [96 x i8]
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = getelementptr inbounds [96 x i8], [96 x i8]* %3, i64 0, i64 0
%8 = call i32 @fwrite(i8* %7, i32 96, i32 1, i32* %4)
%9 = tail call i32 @fflush(i32* %4)
%10 = tail call i32 @fclose(i32* %4)
br label %11
11: ; preds = %2, %6
ret void
}