#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 /*<<< orphan*/ git_pack_hex(char *, unsigned char *);
int /*<<< orphan*/ git_setup(char *);
int /*<<< orphan*/ git_unpack_hex(unsigned char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  unsigned char rawsha[20];
  char sha[41];
  char tester[] = "a600f1d158be31b96cb4502b8768b202c358ad20";
  git_setup("/tmp/gittest/.git");
  git_pack_hex(tester, rawsha);
  printf("raw: (%s)\n", rawsha);
  git_unpack_hex(rawsha, sha);
  printf("sha: (%s)\n", sha);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0x29,%edx
call   1060 <memcpy@plt>
lea    0xea1(%rip),%rdi
call   1040 <git_setup@plt>
lea    -0x90(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1070 <git_pack_hex@plt>
lea    -0x30(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <git_unpack_hex@plt>
lea    -0x60(%rbp),%rsi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
movups 0xec8(%rip),%xmm0
movups %xmm0,0x19(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe97(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeb5(%rip),%rdi
call   1040 <git_setup@plt>
mov    %rsp,%rdi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <git_pack_hex@plt>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x50(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <git_unpack_hex@plt>
lea    0xe95(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.tester = [41 x i8] c"a600f1d158be31b96cb4502b8768b202c358ad20\00"
@.str = [18 x i8] c"/tmp/gittest/.git\00"
@.str.1 = [11 x i8] c"raw: (%s)\0A\00"
@.str.2 = [11 x i8] c"sha: (%s)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i8]
%7 = alloca [41 x i8]
%8 = alloca [41 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [41 x i8]* %8 to i8*
%10 = call i32 @git_setup(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [41 x i8], [41 x i8]* %8, i64 0, i64 0
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%13 = call i32 @git_pack_hex(i8* %11, i8* %12)
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds [41 x i8], [41 x i8]* %7, i64 0, i64 0
%18 = call i32 @git_unpack_hex(i8* %16, i8* %17)
%19 = getelementptr inbounds [41 x i8], [41 x i8]* %7, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %19)
ret i32 0
}

LLVM IR (-O2):
@__const.main.tester = [41 x i8] c"a600f1d158be31b96cb4502b8768b202c358ad20\00"
@.str = [18 x i8] c"/tmp/gittest/.git\00"
@.str.1 = [11 x i8] c"raw: (%s)\0A\00"
@.str.2 = [11 x i8] c"sha: (%s)\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i8]
%4 = alloca [41 x i8]
%5 = alloca [41 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [41 x i8], [41 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [41 x i8], [41 x i8]* %5, i64 0, i64 0
%9 = tail call i32 @git_setup(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @git_pack_hex(i8* %8, i8* %6)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%12 = call i32 @git_unpack_hex(i8* %6, i8* %7)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %7)
ret i32 0
}