#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 sig_makefile(char *, unsigned int, char *, unsigned int, char *,
                 unsigned int *);
int sig_makesig(char *, unsigned int, char *, unsigned int *);
int sig_signandmakefile(char *data, unsigned int datalen, char *filebuf,
                        unsigned int *filelen) {
  static char sigbuf[512];
  unsigned int siglen;
  int r;
  siglen = 512;
  r = sig_makesig(data, datalen, sigbuf, &siglen);
  if (r != 0)
    return 1;
  r = sig_makefile(data, datalen, sigbuf, siglen, filebuf, filelen);
  return r;
}


x86 assembly (clang, -O0):
<sig_signandmakefile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x200,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    0x2ef4(%rip),%rdx
lea    -0x2c(%rbp),%rcx
call   1040 <sig_makesig@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     116e <sig_signandmakefile+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1195 <sig_signandmakefile+0x75>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x2c(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    0x2eb9(%rip),%rdx
call   1030 <sig_makefile@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_signandmakefile>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebp
mov    %rdi,%rbx
movl   $0x200,0x4(%rsp)
lea    0x2eff(%rip),%rdx
lea    0x4(%rsp),%rcx
call   1040 <sig_makesig@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
jne    1171 <sig_signandmakefile+0x51>
mov    0x4(%rsp),%ecx
lea    0x2edf(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r15,%r8
mov    %r14,%r9
call   1030 <sig_makefile@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@sig_signandmakefile.sigbuf = internal global [512 x i8] zeroinitializer
define i32 @sig_signandmakefile(i8* %0, i32 %1, i8* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32* %3, i32** %9
store i32 512, i32* %10
%12 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = call i32 @sig_makesig(i8* %12, i32 %13, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @sig_signandmakefile.sigbuf, i64 0, i64 0), i32* %10)
store i32 %14, i32* %11
%15 = load i32, i32* %11
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %4
store i32 1, i32* %5
br label %26
18: ; preds = %4
%19 = load i8*, i8** %6
%20 = load i32, i32* %7
%21 = load i32, i32* %10
%22 = load i8*, i8** %8
%23 = load i32*, i32** %9
%24 = call i32 @sig_makefile(i8* %19, i32 %20, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @sig_signandmakefile.sigbuf, i64 0, i64 0), i32 %21, i8* %22, i32* %23)
store i32 %24, i32* %11
%25 = load i32, i32* %11
store i32 %25, i32* %5
br label %26
26: ; preds = %18, %17
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
@sig_signandmakefile.sigbuf = internal global [512 x i8] zeroinitializer
define i32 @sig_signandmakefile(i8* %0, i32 %1, i8* %2, i32* %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
store i32 512, i32* %5
%7 = call i32 @sig_makesig(i8* %0, i32 %1, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @sig_signandmakefile.sigbuf, i64 0, i64 0), i32* %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* %5
%11 = call i32 @sig_makefile(i8* %0, i32 %1, i8* getelementptr inbounds ([512 x i8], [512 x i8]* @sig_signandmakefile.sigbuf, i64 0, i64 0), i32 %10, i8* %2, i32* %3)
br label %12
12: ; preds = %4, %9
%13 = phi i32 [ %11, %9 ], [ 1, %4 ]
ret i32 %13
}