xunge/DecIR huggingface dataset:
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
struct timeval timeval_current(void) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return tv;
}


x86 assembly (clang, -O0):
<timeval_current>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval_current>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @timeval_current() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
ret i32 %4
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @timeval_current() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%4 = load i32, i32* %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ gl_getpalettecolors(int /*<<< orphan*/, int, void *);
void gl_getpalette(void *p) { gl_getpalettecolors(0, 256, p); }


x86 assembly (clang, -O0):
<gl_getpalette>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
xor    %edi,%edi
mov    $0x100,%esi
call   1030 <gl_getpalettecolors@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl_getpalette>:
mov    %rdi,%rdx
xor    %edi,%edi
mov    $0x100,%esi
jmp    1030 <gl_getpalettecolors@plt>

LLVM IR (-O0):
define void @gl_getpalette(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @gl_getpalettecolors(i32 0, i32 256, i8* %3)
ret void
}

LLVM IR (-O2):
define void @gl_getpalette(i8* %0) {
%2 = tail call i32 @gl_getpalettecolors(i32 0, i32 256, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ProcessPROTEvent(char *, int, int);
void ProcessPROTData(char *pcBuffer, int iLength, int iBoard) {
  ProcessPROTEvent(pcBuffer, iLength, iBoard);
}


x86 assembly (clang, -O0):
<ProcessPROTData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <ProcessPROTEvent@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ProcessPROTData>:
jmp    1030 <ProcessPROTEvent@plt>

LLVM IR (-O0):
define void @ProcessPROTData(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @ProcessPROTEvent(i8* %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @ProcessPROTData(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @ProcessPROTEvent(i8* %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int fls_long(unsigned long);
__attribute__((const)) unsigned long __rounddown_pow_of_two(unsigned long n) {
  return 1UL << (fls_long(n) - 1);
}


x86 assembly (clang, -O0):
<__rounddown_pow_of_two>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fls_long@plt>
sub    $0x1,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__rounddown_pow_of_two>:
push   %rax
call   1030 <fls_long@plt>
lea    -0x1(%rax),%ecx
mov    $0x1,%eax
shl    %cl,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @__rounddown_pow_of_two(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @fls_long(i64 %3)
%5 = sub nsw i32 %4, 1
%6 = zext i32 %5 to i64
%7 = shl i64 1, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @__rounddown_pow_of_two(i64 %0) {
%2 = tail call i32 @fls_long(i64 %0)
%3 = add nsw i32 %2, -1
%4 = zext i32 %3 to i64
%5 = shl nuw i64 1, %4
ret i64 %5
}
const char *fpp_config_get_plugin_mime_type(void) {
  return "application/x-nacl::Native Client Executable;"
         "application/x-pnacl::Portable Native Client Executable";
}


x86 assembly (clang, -O0):
<fpp_config_get_plugin_mime_type>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpp_config_get_plugin_mime_type>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [100 x i8] c"application/x-nacl::Native Client Executable;application/x-pnacl::Portable Native Client Executable\00"
define i8* @fpp_config_get_plugin_mime_type() {
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [100 x i8] c"application/x-nacl::Native Client Executable;application/x-pnacl::Portable Native Client Executable\00"
define i8* @fpp_config_get_plugin_mime_type() {
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0)
}
void ASN1_STRING_length_set(void) {}


x86 assembly (clang, -O0):
<ASN1_STRING_length_set>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_STRING_length_set>:
ret

LLVM IR (-O0):
define void @ASN1_STRING_length_set() {
ret void
}

LLVM IR (-O2):
define void @ASN1_STRING_length_set() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int, size_t);
int /*<<< orphan*/ perror(char *);
void *xcmalloc(size_t size) {
  void *p = malloc(size);
  if (p == NULL) {
    perror("malloc failed");
    abort();
  }
  memset(p, 0x0, size);
  return p;
}


x86 assembly (clang, -O0):
<xcmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1177 <xcmalloc+0x37>
lea    0xe95(%rip),%rdi
call   1060 <perror@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcmalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <malloc@plt>
test   %rax,%rax
je     116c <xcmalloc+0x2c>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe8d(%rip),%rdi
call   1060 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"malloc failed\00"
define i8* @xcmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = load i64, i64* %2
%14 = call i32 @memset(i8* %12, i32 0, i64 %13)
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [14 x i8] c"malloc failed\00"
define i8* @xcmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
void chunks_init(void) {}


x86 assembly (clang, -O0):
<chunks_init>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chunks_init>:
ret

LLVM IR (-O0):
define void @chunks_init() {
ret void
}

LLVM IR (-O2):
define void @chunks_init() {
ret void
}
int NWD(int m, int n) {
  if (n != 0)
    return NWD(n, m % n);
  else
    return m;
}


x86 assembly (clang, -O0):
<NWD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1141 <NWD+0x31>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <NWD@plt>
mov    %eax,-0x4(%rbp)
jmp    1147 <NWD+0x37>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NWD>:
mov    %edi,%eax
test   %esi,%esi
je     111d <NWD+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <NWD+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @NWD(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = srem i32 %10, %11
%13 = call i32 @NWD(i32 %9, i32 %12)
store i32 %13, i32* %3
br label %16
14: ; preds = %2
%15 = load i32, i32* %4
store i32 %15, i32* %3
br label %16
16: ; preds = %14, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @NWD(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Type definitions */
struct qt_atom {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct qt_atom *);
void free_sub_alac(struct qt_atom *self) { free(self); }


x86 assembly (clang, -O0):
<free_sub_alac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_sub_alac>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.qt_atom = type { i32 }
define void @free_sub_alac(%struct.qt_atom* %0) {
%2 = alloca %struct.qt_atom*
store %struct.qt_atom* %0, %struct.qt_atom** %2
%3 = load %struct.qt_atom*, %struct.qt_atom** %2
%4 = call i32 @free(%struct.qt_atom* %3)
ret void
}

LLVM IR (-O2):
%struct.qt_atom = type { i32 }
define void @free_sub_alac(%struct.qt_atom* nocapture %0) {
%2 = tail call i32 @free(%struct.qt_atom* %0)
ret void
}
void inject_jmp(void *src, void *dest) {
  *(unsigned char *)src = 0xE9;
  *(long *)((unsigned char *)src + 1) =
      (long)((unsigned char *)dest - ((unsigned char *)src + 5));
}


x86 assembly (clang, -O0):
<inject_jmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movb   $0xe9,(%rax)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    $0x5,%rax
sub    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<inject_jmp>:
movb   $0xe9,(%rdi)
sub    %rdi,%rsi
add    $0xfffffffffffffffb,%rsi
mov    %rsi,0x1(%rdi)
ret

LLVM IR (-O0):
define void @inject_jmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
store i8 -23, i8* %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 5
%9 = ptrtoint i8* %6 to i64
%10 = ptrtoint i8* %8 to i64
%11 = sub i64 %9, %10
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = bitcast i8* %13 to i64*
store i64 %11, i64* %14
ret void
}

LLVM IR (-O2):
define void @inject_jmp(i8* %0, i8* %1) {
store i8 -23, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 5
%4 = ptrtoint i8* %1 to i64
%5 = ptrtoint i8* %3 to i64
%6 = sub i64 %4, %5
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = bitcast i8* %7 to i64*
store i64 %6, i64* %8
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ OCSP_SIGNATURE;

/* Variables and functions */
scalar_t__ ASN1_item_new(int /*<<< orphan*/ *);
int /*<<< orphan*/ OCSP_SIGNATURE_it;
OCSP_SIGNATURE *OCSP_SIGNATURE_new(void) {
  return (OCSP_SIGNATURE *)ASN1_item_new(&OCSP_SIGNATURE_it);
}


x86 assembly (clang, -O0):
<OCSP_SIGNATURE_new>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rdi
call   1030 <ASN1_item_new@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<OCSP_SIGNATURE_new>:
mov    0x2ec1(%rip),%rdi
jmp    1030 <ASN1_item_new@plt>

LLVM IR (-O0):
@OCSP_SIGNATURE_it = global i32 0
define i32* @OCSP_SIGNATURE_new() {
%1 = call i64 @ASN1_item_new(i32* @OCSP_SIGNATURE_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}

LLVM IR (-O2):
@OCSP_SIGNATURE_it = global i32 0
define i32* @OCSP_SIGNATURE_new() {
%1 = tail call i64 @ASN1_item_new(i32* @OCSP_SIGNATURE_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}
/* Type definitions */
struct globals {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct globals *);
void globals_shutdown(struct globals *g) {
  free(g);
  g = NULL;
}


x86 assembly (clang, -O0):
<globals_shutdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<globals_shutdown>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.globals = type { i32 }
define void @globals_shutdown(%struct.globals* %0) {
%2 = alloca %struct.globals*
store %struct.globals* %0, %struct.globals** %2
%3 = load %struct.globals*, %struct.globals** %2
%4 = call i32 @free(%struct.globals* %3)
store %struct.globals* null, %struct.globals** %2
ret void
}

LLVM IR (-O2):
%struct.globals = type { i32 }
define void @globals_shutdown(%struct.globals* nocapture %0) {
%2 = tail call i32 @free(%struct.globals* %0)
ret void
}
/* Variables and functions */
scalar_t__ A(int, int, int);
__attribute__((no)) int run() {
  int s = 1;
  for (int i = 0; i < 100000; ++i) {
    s += A(i, i + 1, i + 2);
  }
  return s;
}


x86 assembly (clang, -O0):
<run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x186a0,-0x8(%rbp)
jge    1162 <run+0x52>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%edx
add    $0x2,%edx
call   1030 <A@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <run+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebx
xor    %edi,%edi
nopw   0x0(%rax,%rax,1)
lea    0x1(%rdi),%ebp
lea    0x2(%rdi),%edx
mov    %ebp,%esi
call   1030 <A@plt>
add    %eax,%ebx
mov    %ebp,%edi
cmp    $0x186a0,%ebp
jne    1120 <run+0x10>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @run() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %17, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 100000
br i1 %5, label %6, label %20
6: ; preds = %3
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 2
%12 = call i64 @A(i32 %7, i32 %9, i32 %11)
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = add nsw i64 %14, %12
%16 = trunc i64 %15 to i32
store i32 %16, i32* %1
br label %17
17: ; preds = %6
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %3
20: ; preds = %3
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
define i32 @run() {
br label %2
1: ; preds = %2
ret i32 %9
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %5, %2 ]
%4 = phi i32 [ 1, %0 ], [ %9, %2 ]
%5 = add nuw nsw i32 %3, 1
%6 = add nuw nsw i32 %3, 2
%7 = tail call i64 @A(i32 %3, i32 %5, i32 %6)
%8 = trunc i64 %7 to i32
%9 = add i32 %4, %8
%10 = icmp eq i32 %5, 100000
br i1 %10, label %1, label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_mutex_unlock(int /*<<< orphan*/ *);
void kl_pthread_mutex_unlock(void *data) {
  pthread_mutex_unlock((pthread_mutex_t *)data);
}


x86 assembly (clang, -O0):
<kl_pthread_mutex_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pthread_mutex_unlock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kl_pthread_mutex_unlock>:
jmp    1030 <pthread_mutex_unlock@plt>

LLVM IR (-O0):
define void @kl_pthread_mutex_unlock(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = call i32 @pthread_mutex_unlock(i32* %4)
ret void
}

LLVM IR (-O2):
define void @kl_pthread_mutex_unlock(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @pthread_mutex_unlock(i32* %2)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ write_fsr(int);
void cmd_write_fsr(uint8_t value) {
  printf("writing fsr value: 0x%02x\n", value);
  write_fsr(value);
}


x86 assembly (clang, -O0):
<cmd_write_fsr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <write_fsr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_write_fsr>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <write_fsr@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"writing fsr value: 0x%02x\0A\00"
define void @cmd_write_fsr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @write_fsr(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"writing fsr value: 0x%02x\0A\00"
define void @cmd_write_fsr(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @write_fsr(i32 %0)
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ UINT32_MAX;
int add_uint32_overflows(uint32_t a, uint32_t b) {
  return (b > UINT32_MAX - a);
}


x86 assembly (clang, -O0):
<add_uint32_overflows>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ee1(%rip),%rcx
mov    (%rcx),%rcx
sub    -0x8(%rbp),%rcx
cmp    %rcx,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_uint32_overflows>:
mov    0x2ef1(%rip),%rax
mov    (%rax),%rcx
sub    %rdi,%rcx
xor    %eax,%eax
cmp    %rsi,%rcx
setl   %al
ret

LLVM IR (-O0):
@UINT32_MAX = global i64 0
define i32 @add_uint32_overflows(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* @UINT32_MAX
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = icmp sgt i64 %5, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@UINT32_MAX = global i64 0
define i32 @add_uint32_overflows(i64 %0, i64 %1) {
%3 = load i64, i64* @UINT32_MAX
%4 = sub nsw i64 %3, %0
%5 = icmp slt i64 %4, %1
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
struct passwd {
  int /*<<< orphan*/ pw_uid;
};

/* Variables and functions */
int /*<<< orphan*/ fatal(char *, char const *);
struct passwd *getpwnam(char const *);
uid_t to_uid(const char *user) {
  struct passwd *p;
  p = getpwnam(user);
  if (p == NULL)
    fatal("%s: failed to convert to uid", user);
  return p->pw_uid;
}


x86 assembly (clang, -O0):
<to_uid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getpwnam@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <to_uid+0x34>
mov    -0x8(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1040 <fatal@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_uid>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <getpwnam@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <to_uid+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1040 <fatal@plt>
mov    (%rbx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.passwd = type { i32 }
@.str = [29 x i8] c"%s: failed to convert to uid\00"
define i32 @to_uid(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.passwd*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call %struct.passwd* @getpwnam(i8* %4)
store %struct.passwd* %5, %struct.passwd** %3
%6 = load %struct.passwd*, %struct.passwd** %3
%7 = icmp eq %struct.passwd* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @fatal(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %1
%12 = load %struct.passwd*, %struct.passwd** %3
%13 = getelementptr inbounds %struct.passwd, %struct.passwd* %12, i32 0, i32 0
%14 = load i32, i32* %13
ret i32 %14
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
@.str = [29 x i8] c"%s: failed to convert to uid\00"
define i32 @to_uid(i8* %0) {
%2 = tail call %struct.passwd* @getpwnam(i8* %0)
%3 = icmp eq %struct.passwd* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @fatal(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
%7 = getelementptr inbounds %struct.passwd, %struct.passwd* %2, i64 0, i32 0
%8 = load i32, i32* %7
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint;

/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void getLimits(uint *min, uint *max) { scanf("%u %u", min, max); }


x86 assembly (clang, -O0):
<getLimits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rdi
call   1030 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLimits>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <scanf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%u %u\00"
define void @getLimits(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32*, i32** %4
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%u %u\00"
define void @getLimits(i32* %0, i32* %1) {
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %0, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
size_t memblock_index(size_t len) {
  size_t mlen, idx;
  idx = 0;
  mlen = 8;
  while (mlen < len) {
    idx++;
    mlen = mlen << 1;
  }
  if (idx > (11 - 1))
    fatal("kore_malloc: idx too high");
  return (idx);
}


x86 assembly (clang, -O0):
<memblock_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x8,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1157 <memblock_index+0x47>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112c <memblock_index+0x1c>
cmpq   $0xa,-0x18(%rbp)
jbe    116e <memblock_index+0x5e>
lea    0xe97(%rip),%rdi
call   1030 <fatal@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memblock_index>:
push   %rbx
cmp    $0x9,%rdi
jb     1140 <memblock_index+0x30>
mov    $0x8,%eax
xor    %ebx,%ebx
xchg   %ax,%ax
add    $0x1,%rbx
add    %rax,%rax
cmp    %rdi,%rax
jb     1120 <memblock_index+0x10>
cmp    $0xb,%rbx
jb     1142 <memblock_index+0x32>
lea    0xec7(%rip),%rdi
call   1030 <fatal@plt>
jmp    1142 <memblock_index+0x32>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"kore_malloc: idx too high\00"
define i64 @memblock_index(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %2
store i64 0, i64* %4
store i64 8, i64* %3
br label %5
5: ; preds = %9, %1
%6 = load i64, i64* %3
%7 = load i64, i64* %2
%8 = icmp ult i64 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load i64, i64* %4
%11 = add i64 %10, 1
store i64 %11, i64* %4
%12 = load i64, i64* %3
%13 = shl i64 %12, 1
store i64 %13, i64* %3
br label %5
14: ; preds = %5
%15 = load i64, i64* %4
%16 = icmp ugt i64 %15, 10
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = load i64, i64* %4
ret i64 %20
}

LLVM IR (-O2):
@.str = [26 x i8] c"kore_malloc: idx too high\00"
define i64 @memblock_index(i64 %0) {
%2 = icmp ugt i64 %0, 8
br i1 %2, label %3, label %13
3: ; preds = %1, %3
%4 = phi i64 [ %6, %3 ], [ 0, %1 ]
%5 = phi i64 [ %7, %3 ], [ 8, %1 ]
%6 = add i64 %4, 1
%7 = shl i64 %5, 1
%8 = icmp ult i64 %7, %0
br i1 %8, label %3, label %9
9: ; preds = %3
%10 = icmp ugt i64 %6, 10
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %1, %11, %9
%14 = phi i64 [ %6, %11 ], [ %6, %9 ], [ 0, %1 ]
ret i64 %14
}
int host1x_drm_alloc(struct platform_device *pdev) { return 0; }


x86 assembly (clang, -O0):
<host1x_drm_alloc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<host1x_drm_alloc>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.platform_device = type opaque
define i32 @host1x_drm_alloc(%struct.platform_device* %0) {
%2 = alloca %struct.platform_device*
store %struct.platform_device* %0, %struct.platform_device** %2
ret i32 0
}

LLVM IR (-O2):
%struct.platform_device = type opaque
define i32 @host1x_drm_alloc(%struct.platform_device* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cvector_norm2(double const *, int);
double sqrt(int /*<<< orphan*/);
double cvector_norm(const double *a, int n) {
  return sqrt(cvector_norm2(a, n));
}


x86 assembly (clang, -O0):
<cvector_norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <cvector_norm2@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cvector_norm>:
push   %rax
call   1030 <cvector_norm2@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @cvector_norm(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = load i32, i32* %4
%7 = call i32 @cvector_norm2(double* %5, i32 %6)
%8 = call double @sqrt(i32 %7)
ret double %8
}

LLVM IR (-O2):
define double @cvector_norm(double* %0, i32 %1) {
%3 = tail call i32 @cvector_norm2(double* %0, i32 %1)
%4 = tail call double @sqrt(i32 %3)
ret double %4
}
int islower(int c) { return (((c) <= (0x7a)) && ((c) >= (0x61))); }


x86 assembly (clang, -O0):
<islower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x7a,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jg     1120 <islower+0x20>
cmpl   $0x61,-0x4(%rbp)
setge  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<islower>:
add    $0xffffff9f,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @islower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 122
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 97
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @islower(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glOrtho(int, int, int, int, int, int);
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
void init(void) {
  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glLoadIdentity();
  glOrtho(50, 50, 50, 50, 50, 50);
  glPopMatrix();
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1070 <glPushMatrix@plt>
mov    $0x0,%al
call   1060 <glLoadIdentity@plt>
mov    $0x32,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
call   1040 <glOrtho@plt>
mov    $0x0,%al
call   1050 <glPopMatrix@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rax
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1070 <glPushMatrix@plt>
xor    %eax,%eax
call   1060 <glLoadIdentity@plt>
mov    $0x32,%edi
mov    $0x32,%esi
mov    $0x32,%edx
mov    $0x32,%ecx
mov    $0x32,%r8d
mov    $0x32,%r9d
call   1040 <glOrtho@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glPopMatrix@plt>

LLVM IR (-O0):
@GL_MODELVIEW = global i32 0
define void @init() {
%1 = load i32, i32* @GL_MODELVIEW
%2 = call i32 @glMatrixMode(i32 %1)
%3 = call i32 (...) @glPushMatrix()
%4 = call i32 (...) @glLoadIdentity()
%5 = call i32 @glOrtho(i32 50, i32 50, i32 50, i32 50, i32 50, i32 50)
%6 = call i32 (...) @glPopMatrix()
ret void
}

LLVM IR (-O2):
@GL_MODELVIEW = global i32 0
define void @init() {
%1 = load i32, i32* @GL_MODELVIEW
%2 = tail call i32 @glMatrixMode(i32 %1)
%3 = tail call i32 (...) @glPushMatrix()
%4 = tail call i32 (...) @glLoadIdentity()
%5 = tail call i32 @glOrtho(i32 50, i32 50, i32 50, i32 50, i32 50, i32 50)
%6 = tail call i32 (...) @glPopMatrix()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printint(void *data) { printf("%d\n", *(int *)data); }


x86 assembly (clang, -O0):
<printint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printint>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @printint(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @printint(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ lseek(int, int /*<<< orphan*/, int);
off_t libc_lseek(int fd, off_t offset, int whence) {
  return lseek(fd, offset, whence);
}


x86 assembly (clang, -O0):
<libc_lseek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <lseek@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libc_lseek>:
jmp    1030 <lseek@plt>

LLVM IR (-O0):
define i32 @libc_lseek(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @lseek(i32 %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @libc_lseek(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @lseek(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
void short_usage(FILE *f) {
  fputs("Usage: peflags [OPTIONS] file(s)...\n", f);
  fputs("Sets or clears various flags in PE files (that is, exes and dlls)\n",
        f);
  fputs("Use --help for full help text\n", f);
}


x86 assembly (clang, -O0):
<short_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rsi
lea    0xeee(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rsi
lea    0xf21(%rip),%rdi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<short_usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    $0x24,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xef1(%rip),%rdi
mov    $0x42,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xf1b(%rip),%rdi
mov    $0x1e,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Usage: peflags [OPTIONS] file(s)...\0A\00"
@.str.1 = [67 x i8] c"Sets or clears various flags in PE files (that is, exes and dlls)\0A\00"
@.str.2 = [31 x i8] c"Use --help for full help text\0A\00"
define void @short_usage(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fputs(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = load i32*, i32** %2
%6 = call i32 @fputs(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%7 = load i32*, i32** %2
%8 = call i32 @fputs(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32* %7)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"Usage: peflags [OPTIONS] file(s)...\0A\00"
@.str.1 = [67 x i8] c"Sets or clears various flags in PE files (that is, exes and dlls)\0A\00"
@.str.2 = [31 x i8] c"Use --help for full help text\0A\00"
define void @short_usage(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 36, i64 1, i32* %0)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0), i64 66, i64 1, i32* %0)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i64 30, i64 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hlt();
void halt(void) { hlt(); }


x86 assembly (clang, -O0):
<halt>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <hlt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<halt>:
xor    %eax,%eax
jmp    1030 <hlt@plt>

LLVM IR (-O0):
define void @halt() {
%1 = call i32 (...) @hlt()
ret void
}

LLVM IR (-O2):
define void @halt() {
%1 = tail call i32 (...) @hlt()
ret void
}
void XtManageChildren() {}


x86 assembly (clang, -O0):
<XtManageChildren>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XtManageChildren>:
ret

LLVM IR (-O0):
define void @XtManageChildren() {
ret void
}

LLVM IR (-O2):
define void @XtManageChildren() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int spawn(char args[128]) {
  int numProcs = 0;
  sscanf(args, "%d", &numProcs);
  printf("I am in spawn, %d processes\n", numProcs);
  return 0;
}


x86 assembly (clang, -O0):
<spawn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0xc(%rbp),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spawn>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1040 <sscanf@plt>
mov    0x4(%rsp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"I am in spawn, %d processes\0A\00"
define i32 @spawn(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"I am in spawn, %d processes\0A\00"
define i32 @spawn(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
void *malloc(size_t);
void *btree_malloc(size_t nbytes) {
  void *p = NULL;
  p = malloc(nbytes);
  return p;
}


x86 assembly (clang, -O0):
<btree_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btree_malloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @btree_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
store i8* null, i8** %3
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @btree_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
unsigned int howmany(unsigned int input) {
  input--;
  return input < 1 ? 0 : input + howmany(input);
}


x86 assembly (clang, -O0):
<howmany>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jae    1138 <howmany+0x28>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1150 <howmany+0x40>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <howmany@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<howmany>:
lea    -0x1(%rdi),%eax
add    $0xfffffffe,%edi
imul   %rax,%rdi
shr    %rdi
imul   %eax,%eax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @howmany(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, -1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp ult i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %1
br label %13
8: ; preds = %1
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = call i32 @howmany(i32 %10)
%12 = add i32 %9, %11
br label %13
13: ; preds = %8, %7
%14 = phi i32 [ 0, %7 ], [ %12, %8 ]
ret i32 %14
}

LLVM IR (-O2):
define i32 @howmany(i32 %0) {
%2 = add i32 %0, -1
%3 = zext i32 %2 to i33
%4 = add i32 %0, -2
%5 = zext i32 %4 to i33
%6 = mul i33 %3, %5
%7 = lshr i33 %6, 1
%8 = trunc i33 %7 to i32
%9 = mul i32 %2, %2
%10 = sub i32 %9, %8
ret i32 %10
}
/* Variables and functions */
float frand();
int rand_binomial(int n, float p) {
  int b = 0;
  int i;
  for (i = 0; i < n; i++) {
    if (frand() < p) {
      b++;
    }
  }
  return b;
}


x86 assembly (clang, -O0):
<rand_binomial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    116e <rand_binomial+0x5e>
mov    $0x0,%al
call   1030 <frand@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    115b <rand_binomial+0x4b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1160 <rand_binomial+0x50>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112e <rand_binomial+0x1e>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_binomial>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    114e <rand_binomial+0x3e>
mov    %edi,%ebx
xor    %ebp,%ebp
movss  %xmm0,0x4(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <frand@plt>
xor    %eax,%eax
movss  0x4(%rsp),%xmm1
ucomiss %xmm0,%xmm1
seta   %al
add    %eax,%ebp
add    $0xffffffff,%ebx
jne    1130 <rand_binomial+0x20>
jmp    1150 <rand_binomial+0x40>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rand_binomial(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store float %1, float* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = call float (...) @frand()
%13 = load float, float* %4
%14 = fcmp olt float %12, %13
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %18
18: ; preds = %15, %11
br label %19
19: ; preds = %18
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %7
22: ; preds = %7
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
define i32 @rand_binomial(i32 %0, float %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 0, %2 ]
%6 = phi i32 [ %10, %4 ], [ 0, %2 ]
%7 = tail call float (...) @frand()
%8 = fcmp olt float %7, %1
%9 = zext i1 %8 to i32
%10 = add nuw nsw i32 %6, %9
%11 = add nuw nsw i32 %5, 1
%12 = icmp eq i32 %11, %0
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi i32 [ 0, %2 ], [ %10, %4 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ popNumber();
int /*<<< orphan*/ pushNumber(int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(int /*<<< orphan*/);
void basSqr() { pushNumber(sqrt(popNumber())); }


x86 assembly (clang, -O0):
<basSqr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
mov    %eax,%edi
call   1030 <pushNumber@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<basSqr>:
push   %rax
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <pushNumber@plt>

LLVM IR (-O0):
define void @basSqr() {
%1 = call i32 (...) @popNumber()
%2 = call i32 @sqrt(i32 %1)
%3 = call i32 @pushNumber(i32 %2)
ret void
}

LLVM IR (-O2):
define void @basSqr() {
%1 = tail call i32 (...) @popNumber()
%2 = tail call i32 @sqrt(i32 %1)
%3 = tail call i32 @pushNumber(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, void const *, size_t const);
char *pack_mem(const void *data, const size_t size, char *buffer) {
  memcpy(buffer, data, size);
  return buffer + size;
}


x86 assembly (clang, -O0):
<pack_mem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_mem>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%rsi
mov    %rdx,%rdi
mov    %r14,%rdx
call   1030 <memcpy@plt>
add    %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @pack_mem(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = call i32 @memcpy(i8* %7, i8* %8, i64 %9)
%11 = load i8*, i8** %6
%12 = load i64, i64* %5
%13 = getelementptr inbounds i8, i8* %11, i64 %12
ret i8* %13
}

LLVM IR (-O2):
define i8* @pack_mem(i8* %0, i64 %1, i8* %2) {
%4 = tail call i32 @memcpy(i8* %2, i8* %0, i64 %1)
%5 = getelementptr inbounds i8, i8* %2, i64 %1
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_cvector(char *v, long nl, long nh) { free((char *)(v + nl - 1)); }


x86 assembly (clang, -O0):
<free_cvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
add    -0x10(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_cvector>:
add    %rsi,%rdi
add    $0xffffffffffffffff,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_cvector(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = getelementptr inbounds i8, i8* %7, i64 %8
%10 = getelementptr inbounds i8, i8* %9, i64 -1
%11 = call i32 @free(i8* %10)
ret void
}

LLVM IR (-O2):
define void @free_cvector(i8* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 %1
%5 = getelementptr inbounds i8, i8* %4, i64 -1
%6 = tail call i32 @free(i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dijkstra(int **, int, int *);
int distance(int g[10][10], int nodeA, int nodeB) {
  int distance[10];
  dijkstra(g, nodeA, distance);
  return distance[nodeB];
}


x86 assembly (clang, -O0):
<distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x40(%rbp),%rdx
call   1030 <dijkstra@plt>
movslq -0x10(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance>:
push   %rbx
sub    $0x30,%rsp
mov    %edx,%ebx
mov    %rsp,%rdx
call   1030 <dijkstra@plt>
movslq %ebx,%rax
mov    (%rsp,%rax,4),%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @distance([10 x i32]* %0, i32 %1, i32 %2) {
%4 = alloca [10 x i32]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [10 x i32]
store [10 x i32]* %0, [10 x i32]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load [10 x i32]*, [10 x i32]** %4
%9 = bitcast [10 x i32]* %8 to i32**
%10 = load i32, i32* %5
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%12 = call i32 @dijkstra(i32** %9, i32 %10, i32* %11)
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 %14
%16 = load i32, i32* %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @distance([10 x i32]* %0, i32 %1, i32 %2) {
%4 = alloca [10 x i32]
%5 = bitcast [10 x i32]* %4 to i8*
%6 = bitcast [10 x i32]* %0 to i32**
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%8 = call i32 @dijkstra(i32** %6, i32 %1, i32* %7)
%9 = sext i32 %2 to i64
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %9
%11 = load i32, i32* %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_SET_YELLOW_LED_PIN() { set_io_bit(0x37, 5); }


x86 assembly (clang, -O0):
<TOSH_SET_YELLOW_LED_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x37,%edi
mov    $0x5,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_SET_YELLOW_LED_PIN>:
mov    $0x37,%edi
mov    $0x5,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_SET_YELLOW_LED_PIN() {
%1 = call i32 @set_io_bit(i32 55, i32 5)
ret void
}

LLVM IR (-O2):
define void @TOSH_SET_YELLOW_LED_PIN() {
%1 = tail call i32 @set_io_bit(i32 55, i32 5)
ret void
}