xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: tpt [-s] [-m MHz] [filename]\n");
  fprintf(stderr, "       -s       : produce output compatible with sort(1)\n");
  fprintf(stderr, "       -m MHz   : specify target machine's CPU rate "
                  "(default from local /proc/cpuinfo)\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xf01(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee6(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf12(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: tpt [-s] [-m MHz] [filename]\0A\00"
@.str.1 = [58 x i8] c" -s : produce output compatible with sort(1)\0A\00"
@.str.2 = [88 x i8] c" -m MHz : specify target machine's CPU rate (default from local /proc/cpuinfo)\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: tpt [-s] [-m MHz] [filename]\0A\00"
@.str.1 = [58 x i8] c" -s : produce output compatible with sort(1)\0A\00"
@.str.2 = [88 x i8] c" -m MHz : specify target machine's CPU rate (default from local /proc/cpuinfo)\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
}
int eval_scaled_dimension(int v) {
  int tmp_shift = v - 2;
  int counter = 0;
  int result = 0;
  while (tmp_shift > 1) {
    tmp_shift = tmp_shift >> 1;
    ++counter;
  }
  result = (0x1 << (counter + 1)) + 1;
  return result;
}


x86 assembly (clang, -O0):
<eval_scaled_dimension>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    113f <eval_scaled_dimension+0x3f>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111e <eval_scaled_dimension+0x1e>
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval_scaled_dimension>:
mov    $0x1,%eax
mov    $0x1,%ecx
cmp    $0x4,%edi
jl     112c <eval_scaled_dimension+0x2c>
add    $0xfffffffe,%edi
mov    $0x1,%ecx
mov    %edi,%edx
nopl   0x0(%rax)
shr    %edx
add    $0x1,%ecx
cmp    $0x3,%edi
mov    %edx,%edi
ja     1120 <eval_scaled_dimension+0x20>
shl    %cl,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @eval_scaled_dimension(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = sub nsw i32 %6, 2
store i32 %7, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %8
8: ; preds = %11, %1
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load i32, i32* %3
%13 = ashr i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %8
16: ; preds = %8
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
%19 = shl i32 1, %18
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
define i32 @eval_scaled_dimension(i32 %0) {
%2 = icmp sgt i32 %0, 3
br i1 %2, label %3, label %11
3: ; preds = %1
%4 = add nsw i32 %0, -2
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ 1, %3 ]
%7 = phi i32 [ %8, %5 ], [ %4, %3 ]
%8 = lshr i32 %7, 1
%9 = add nuw nsw i32 %6, 1
%10 = icmp ugt i32 %7, 3
br i1 %10, label %5, label %11
11: ; preds = %5, %1
%12 = phi i32 [ 1, %1 ], [ %9, %5 ]
%13 = shl nuw i32 1, %12
%14 = add nuw nsw i32 %13, 1
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int use(char *name) {
  printf("use: %s assemblyfile [objectfile]\n", name);
  return 8;
}


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

x86 assembly (clang, -O2):
<use>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x8,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"use: %s assemblyfile [objectfile]\0A\00"
define i32 @use(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 8
}

LLVM IR (-O2):
@.str = [35 x i8] c"use: %s assemblyfile [objectfile]\0A\00"
define i32 @use(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ __setCHRBank6High(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ vrc2_4_SetChrROMBank6();
void vrc2_4_setParamsEXX1(uint16_t addr, uint8_t val) {
  __setCHRBank6High(addr, val);
  vrc2_4_SetChrROMBank6();
}


x86 assembly (clang, -O0):
<vrc2_4_setParamsEXX1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <__setCHRBank6High@plt>
mov    $0x0,%al
call   1030 <vrc2_4_SetChrROMBank6@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vrc2_4_setParamsEXX1>:
push   %rax
call   1040 <__setCHRBank6High@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <vrc2_4_SetChrROMBank6@plt>

LLVM IR (-O0):
define void @vrc2_4_setParamsEXX1(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 @__setCHRBank6High(i32 %5, i32 %6)
%8 = call i32 (...) @vrc2_4_SetChrROMBank6()
ret void
}

LLVM IR (-O2):
define void @vrc2_4_setParamsEXX1(i32 %0, i32 %1) {
%3 = tail call i32 @__setCHRBank6High(i32 %0, i32 %1)
%4 = tail call i32 (...) @vrc2_4_SetChrROMBank6()
ret void
}
int main(void) {
  int i = -42;
  return i;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffd6,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0xffffffd6,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 -42, i32* %2
%3 = load i32, i32* %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @main() {
ret i32 -42
}
/* Variables and functions */
scalar_t__ is_number(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
void get_error_reponse(char *buffer, char *response) {
  if (is_number(buffer)) {
    sprintf(response, "Cannot find id = %s", buffer);
  } else {
    sprintf(response, "Cannot find an app named : %s", buffer);
  }
}


x86 assembly (clang, -O0):
<get_error_reponse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <is_number@plt>
cmp    $0x0,%rax
je     115c <get_error_reponse+0x3c>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeae(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1170 <get_error_reponse+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xea9(%rip),%rsi
call   1040 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_error_reponse>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <is_number@plt>
test   %rax,%rax
lea    0xedb(%rip),%rax
lea    0xec0(%rip),%rsi
cmove  %rax,%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <sprintf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Cannot find id = %s\00"
@.str.1 = [30 x i8] c"Cannot find an app named : %s\00"
define void @get_error_reponse(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
%6 = call i64 @is_number(i8* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = load i8*, i8** %3
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %16
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = load i8*, i8** %3
%15 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %16
16: ; preds = %12, %8
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Cannot find id = %s\00"
@.str.1 = [30 x i8] c"Cannot find an app named : %s\00"
define void @get_error_reponse(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i64 @is_number(i8* %0)
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) %5, i8* %0)
ret void
}
void *FS__CLIB_memset(void *s, int c, unsigned long n) {
  const unsigned char uc = c;
  unsigned char *su = (unsigned char *)s;
  for (; 0 < n; ++su, --n) {
    *su = uc;
  }
  return s;
}


x86 assembly (clang, -O0):
<FS__CLIB_memset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0x19(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jae    114f <FS__CLIB_memset+0x4f>
mov    -0x19(%rbp),%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    111d <FS__CLIB_memset+0x1d>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FS__CLIB_memset>:
push   %rbx
mov    %rdi,%rbx
test   %rdx,%rdx
je     1121 <FS__CLIB_memset+0x11>
mov    %rbx,%rdi
call   1030 <memset@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @FS__CLIB_memset(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8
%8 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%9 = load i32, i32* %5
%10 = trunc i32 %9 to i8
store i8 %10, i8* %7
%11 = load i8*, i8** %4
store i8* %11, i8** %8
br label %12
12: ; preds = %18, %3
%13 = load i64, i64* %6
%14 = icmp ult i64 0, %13
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i8, i8* %7
%17 = load i8*, i8** %8
store i8 %16, i8* %17
br label %18
18: ; preds = %15
%19 = load i8*, i8** %8
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %8
%21 = load i64, i64* %6
%22 = add i64 %21, -1
store i64 %22, i64* %6
br label %12
23: ; preds = %12
%24 = load i8*, i8** %4
ret i8* %24
}

LLVM IR (-O2):
define i8* @FS__CLIB_memset(i8* returned writeonly %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
br label %7
7: ; preds = %5, %3
ret i8* %0
}
/* Variables and functions */
float __ocml_sub_rtn_f32(float, float);
float __fsub_ru(float x, float y) { return __ocml_sub_rtn_f32(x, y); }


x86 assembly (clang, -O0):
<__fsub_ru>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <__ocml_sub_rtn_f32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fsub_ru>:
jmp    1030 <__ocml_sub_rtn_f32@plt>

LLVM IR (-O0):
define float @__fsub_ru(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call float @__ocml_sub_rtn_f32(float %5, float %6)
ret float %7
}

LLVM IR (-O2):
define float @__fsub_ru(float %0, float %1) {
%3 = tail call float @__ocml_sub_rtn_f32(float %0, float %1)
ret float %3
}
/* Variables and functions */
int i_dim(int *, int *);
int intr_wrap_165(int p1, int p2) { return i_dim(&p1, &p2); }


x86 assembly (clang, -O0):
<intr_wrap_165>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <i_dim@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_165>:
push   %rax
mov    %edi,0x4(%rsp)
mov    %esi,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <i_dim@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @intr_wrap_165(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @i_dim(i32* %3, i32* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @intr_wrap_165(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @i_dim(i32* %3, i32* %4)
ret i32 %5
}
int set_dip_data(struct xhda_codec *codec, struct xhda_node *node,
                 unsigned int cmd) {
  return 0;
}


x86 assembly (clang, -O0):
<set_dip_data>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.xhda_codec = type opaque
%struct.xhda_node = type opaque
define i32 @set_dip_data(%struct.xhda_codec* %0, %struct.xhda_node* %1, i32 %2) {
%4 = alloca %struct.xhda_codec*
%5 = alloca %struct.xhda_node*
%6 = alloca i32
store %struct.xhda_codec* %0, %struct.xhda_codec** %4
store %struct.xhda_node* %1, %struct.xhda_node** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
%struct.xhda_codec = type opaque
%struct.xhda_node = type opaque
define i32 @set_dip_data(%struct.xhda_codec* nocapture readnone %0, %struct.xhda_node* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
scalar_t__ rand_port();
double rand_rect_port(void) {
  return (double)rand_port() / (double)((2147483647L - 1) + 1);
}


x86 assembly (clang, -O0):
<rand_rect_port>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand_port@plt>
cvtsi2sd %rax,%xmm0
movsd  0xed8(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_rect_port>:
push   %rax
xor    %eax,%eax
call   1030 <rand_port@plt>
cvtsi2sd %rax,%xmm0
divsd  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rand_rect_port() {
%1 = call i64 (...) @rand_port()
%2 = sitofp i64 %1 to double
%3 = fdiv double %2, 0x41DFFFFFFFC00000
ret double %3
}

LLVM IR (-O2):
define double @rand_rect_port() {
%1 = tail call i64 (...) @rand_port()
%2 = sitofp i64 %1 to double
%3 = fdiv double %2, 0x41DFFFFFFFC00000
ret double %3
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
uint8_t char_shift_adjust(uint8_t c, uint8_t shift) {
  return c + (shift ? ('A' - 'a') : 0);
}


x86 assembly (clang, -O0):
<char_shift_adjust>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rsi
xor    %ecx,%ecx
mov    $0xffffffe0,%edx
cmp    $0x0,%rsi
cmovne %edx,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_shift_adjust>:
xor    %eax,%eax
test   %rsi,%rsi
sete   %al
shl    $0x5,%rax
add    %rdi,%rax
add    $0xffffffffffffffe0,%rax
ret

LLVM IR (-O0):
define i64 @char_shift_adjust(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -32, i32 0
%10 = sext i32 %9 to i64
%11 = add nsw i64 %5, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @char_shift_adjust(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
%4 = select i1 %3, i64 0, i64 -32
%5 = add nsw i64 %4, %0
ret i64 %5
}
void _M2_NumberIO_finish(__attribute__((unused)) int argc,
                         __attribute__((unused)) char *argv[]) {}


x86 assembly (clang, -O0):
<_M2_NumberIO_finish>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @_M2_NumberIO_finish(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret void
}

LLVM IR (-O2):
define void @_M2_NumberIO_finish(i32 %0, i8** nocapture %1) {
ret void
}
int ShrTest2(int X, unsigned C1, int C2) { return (X >> C1) & C2; }


x86 assembly (clang, -O0):
<ShrTest2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShrTest2>:
mov    %esi,%ecx
mov    %edi,%eax
sar    %cl,%eax
and    %edx,%eax
ret

LLVM IR (-O0):
define i32 @ShrTest2(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 = ashr i32 %7, %8
%10 = load i32, i32* %6
%11 = and i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @ShrTest2(i32 %0, i32 %1, i32 %2) {
%4 = ashr i32 %0, %1
%5 = and i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int _isupper(int);
int isupper(int c) { return _isupper(c); }


x86 assembly (clang, -O0):
<isupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_isupper@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isupper>:
jmp    1030 <_isupper@plt>

LLVM IR (-O0):
define i32 @isupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_isupper(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @isupper(i32 %0) {
%2 = tail call i32 @_isupper(i32 %0)
ret i32 %2
}
int fun1324() { return 1324; }


x86 assembly (clang, -O0):
<fun1324>:
push   %rbp
mov    %rsp,%rbp
mov    $0x52c,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun1324>:
mov    $0x52c,%eax
ret

LLVM IR (-O0):
define i32 @fun1324() {
ret i32 1324
}

LLVM IR (-O2):
define i32 @fun1324() {
ret i32 1324
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Usage: dasm09 [options] <filename>\n"
         "Available options are:\n"
         " -begin  - start disassembly address [offset]\n"
         " -end    - end disassembly address  [auto]\n"
         " -offset - address to load program [0]\n"
         " -out    - output file [stdout]\n"
         " -noaddr - no address dump\n"
         " -nohex  - no hex dump\n"
         " -x      - use 6309 opcodes\n"
         " -os9    - patch swi2 (os9 call)\n"
         "All values should be entered in hexadecimal\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [374 x i8] c"Usage: dasm09 [options] <filename>\0AAvailable options are:\0A -begin - start disassembly address [offset]\0A -end - end disassembly address [auto]\0A -offset - address to load program [0]\0A -out - output file [stdout]\0A -noaddr - no address dump\0A -nohex - no hex dump\0A -x - use 6309 opcodes\0A -os9 - patch swi2 (os9 call)\0AAll values should be entered in hexadecimal\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([374 x i8], [374 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [373 x i8] c"Usage: dasm09 [options] <filename>\0AAvailable options are:\0A -begin - start disassembly address [offset]\0A -end - end disassembly address [auto]\0A -offset - address to load program [0]\0A -out - output file [stdout]\0A -noaddr - no address dump\0A -nohex - no hex dump\0A -x - use 6309 opcodes\0A -os9 - patch swi2 (os9 call)\0AAll values should be entered in hexadecimal\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([373 x i8], [373 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int nrand(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int choice = 0;
  int secret = 0;
  secret = nrand(101);
  while (choice != secret) {
    printf("%d\n", choice);
    choice = nrand(101);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x65,%edi
call   1030 <nrand@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1177 <main+0x57>
mov    -0x8(%rbp),%esi
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x65,%edi
call   1030 <nrand@plt>
mov    %eax,-0x8(%rbp)
jmp    114a <main+0x2a>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x65,%edi
call   1030 <nrand@plt>
test   %eax,%eax
je     1158 <main+0x38>
mov    %eax,%ebx
xor    %eax,%eax
lea    0xec3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x65,%edi
call   1030 <nrand@plt>
cmp    %ebx,%eax
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = call i32 @nrand(i32 101)
store i32 %4, i32* %3
br label %5
5: ; preds = %9, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @nrand(i32 101)
store i32 %12, i32* %2
br label %5
13: ; preds = %5
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @nrand(i32 101)
%2 = icmp eq i32 %1, 0
br i1 %2, label %8, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ 0, %0 ]
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 @nrand(i32 101)
%7 = icmp eq i32 %6, %1
br i1 %7, label %8, label %3
8: ; preds = %3, %0
ret i32 0
}
/* Variables and functions */
size_t ZBUFF_recommendedDInSize() { return (128 * 1024) + 3; }


x86 assembly (clang, -O0):
<ZBUFF_recommendedDInSize>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20003,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZBUFF_recommendedDInSize>:
mov    $0x20003,%eax
ret

LLVM IR (-O0):
define i64 @ZBUFF_recommendedDInSize() {
ret i64 131075
}

LLVM IR (-O2):
define i64 @ZBUFF_recommendedDInSize() {
ret i64 131075
}
/* Type definitions */
struct buf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bufput(struct buf *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
void bufputs(struct buf *buf, const char *str) {
  bufput(buf, str, strlen(str));
}


x86 assembly (clang, -O0):
<bufputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <bufput@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bufputs>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <bufput@plt>

LLVM IR (-O0):
%struct.buf = type { i32 }
define void @bufputs(%struct.buf* %0, i8* %1) {
%3 = alloca %struct.buf*
%4 = alloca i8*
store %struct.buf* %0, %struct.buf** %3
store i8* %1, i8** %4
%5 = load %struct.buf*, %struct.buf** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @bufput(%struct.buf* %5, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
%struct.buf = type { i32 }
define void @bufputs(%struct.buf* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @bufput(%struct.buf* %0, i8* %1, i32 %3)
ret void
}
/* Variables and functions */
int getopt(int, char **, char *);
int get_verbose(char **argv, int argc) {
  int c;
  int verbose = 0;
  while ((c = getopt(argc, argv, "v")) != -1) {
    switch (c) {
    case 'v':
      verbose = 1;
      break;
    default:
      break;
    }
  }
  return verbose;
}


x86 assembly (clang, -O0):
<get_verbose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
lea    0xecc(%rip),%rdx
call   1030 <getopt@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xffffffff,%eax
je     116c <get_verbose+0x5c>
mov    -0x10(%rbp),%eax
sub    $0x76,%eax
jne    1162 <get_verbose+0x52>
jmp    1156 <get_verbose+0x46>
movl   $0x1,-0x14(%rbp)
jmp    1167 <get_verbose+0x57>
jmp    1167 <get_verbose+0x57>
jmp    1126 <get_verbose+0x16>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_verbose>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %r14d,%r14d
lea    0xeda(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <getopt@plt>
cmp    $0x76,%eax
je     1149 <get_verbose+0x39>
cmp    $0xffffffff,%eax
jne    1130 <get_verbose+0x20>
jmp    1151 <get_verbose+0x41>
mov    $0x1,%r14d
jmp    1130 <get_verbose+0x20>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"v\00"
define i32 @get_verbose(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
store i32 0, i32* %6
br label %7
7: ; preds = %16, %2
%8 = load i32, i32* %4
%9 = load i8**, i8*** %3
%10 = call i32 @getopt(i32 %8, i8** %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %5
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = load i32, i32* %5
switch i32 %13, label %15 [
i32 118, label %14
]
14: ; preds = %12
store i32 1, i32* %6
br label %16
15: ; preds = %12
br label %16
16: ; preds = %15, %14
br label %7
17: ; preds = %7
%18 = load i32, i32* %6
ret i32 %18
}

LLVM IR (-O2):
@.str = [2 x i8] c"v\00"
define i32 @get_verbose(i8** %0, i32 %1) {
br label %3
3: ; preds = %5, %2
%4 = phi i32 [ 0, %2 ], [ 1, %5 ]
br label %5
5: ; preds = %3, %5
%6 = tail call i32 @getopt(i32 %1, i8** %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %5 [
i32 -1, label %7
i32 118, label %3
]
7: ; preds = %5
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
int32_t hconv_bitlen(uint32_t bitlen) {
  int32_t len;
  len = (int32_t)(bitlen >> 3);
  if (((int32_t)bitlen & 7) != 0)
    len++;
  return (len);
}


x86 assembly (clang, -O0):
<hconv_bitlen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
je     1128 <hconv_bitlen+0x28>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hconv_bitlen>:
mov    %edi,%eax
sar    $0x3,%eax
and    $0x7,%edi
cmp    $0x1,%edi
sbb    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @hconv_bitlen(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 3
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = and i32 %6, 7
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @hconv_bitlen(i32 %0) {
%2 = ashr i32 %0, 3
%3 = and i32 %0, 7
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
%6 = add nsw i32 %2, %5
ret i32 %6
}
/* Variables and functions */
long fibonacci(long);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, long *);
int main(void) {
  long result;
  long number;
  printf("Enter an integer: ");
  scanf("%ld", &number);
  result = fibonacci(number);
  printf("Fibonacci( %ld ) = %ld\n", number, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fibonacci@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%rdi
call   1040 <fibonacci@plt>
mov    (%rsp),%rsi
lea    0xeb5(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter an integer: \00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [24 x i8] c"Fibonacci( %ld ) = %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %3)
%6 = load i64, i64* %3
%7 = call i64 @fibonacci(i64 %6)
store i64 %7, i64* %2
%8 = load i64, i64* %3
%9 = load i64, i64* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 %8, i64 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter an integer: \00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [24 x i8] c"Fibonacci( %ld ) = %ld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%5 = load i64, i64* %1
%6 = call i64 @fibonacci(i64 %5)
%7 = load i64, i64* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 %7, i64 %6)
ret i32 0
}
int cmpfunc(const void *a, const void *b) { return (*(int *)b - *(int *)a); }


x86 assembly (clang, -O0):
<cmpfunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpfunc>:
mov    (%rsi),%eax
sub    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @cmpfunc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmpfunc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
unsigned int array_uint32_le(const unsigned char data[]) {
  return data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24);
}


x86 assembly (clang, -O0):
<array_uint32_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x18,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_uint32_le>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @array_uint32_le(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = add nsw i32 %6, %11
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl i32 %16, 16
%18 = add nsw i32 %12, %17
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 3
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = shl i32 %22, 24
%24 = add nsw i32 %18, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @array_uint32_le(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl nuw i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
void rop3_202_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = S ^ *D;
  stk2 = T & stk3;
  stk1 = *D ^ stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_202_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
xor    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xd(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @rop3_202_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = xor i32 %11, %14
%16 = trunc i32 %15 to i8
store i8 %16, i8* %9
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = load i8, i8* %9
%20 = zext i8 %19 to i32
%21 = and i32 %18, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %8
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = load i8, i8* %8
%27 = zext i8 %26 to i32
%28 = xor i32 %25, %27
%29 = trunc i32 %28 to i8
store i8 %29, i8* %7
%30 = load i8, i8* %7
%31 = zext i8 %30 to i32
%32 = load i8, i8* %5
%33 = zext i8 %32 to i32
%34 = xor i32 %33, -1
%35 = and i32 %31, %34
%36 = load i8, i8* %6
%37 = zext i8 %36 to i32
%38 = xor i32 %37, -1
%39 = and i32 %35, %38
%40 = load i8*, i8** %4
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = load i8, i8* %5
%44 = zext i8 %43 to i32
%45 = and i32 %42, %44
%46 = or i32 %39, %45
%47 = load i8*, i8** %4
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = load i8, i8* %6
%51 = zext i8 %50 to i32
%52 = and i32 %49, %51
%53 = or i32 %46, %52
%54 = trunc i32 %53 to i8
%55 = load i8*, i8** %4
store i8 %54, i8* %55
ret void
}

LLVM IR (-O2):
define void @rop3_202_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void printer() {
  printf("hello\n");
  sleep(5);
}


x86 assembly (clang, -O0):
<printer>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1040 <sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printer>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
pop    %rax
jmp    1040 <sleep@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"hello\0A\00"
define void @printer() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @sleep(i32 5)
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define void @printer() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @sleep(i32 5)
ret void
}
int crypt_fips_mode(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @crypt_fips_mode() {
ret i32 0
}

LLVM IR (-O2):
define i32 @crypt_fips_mode() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef scalar_t__ int64_t;
typedef int int32_t;

/* Variables and functions */
int32_t int64_comparator(const void *l, const void *r) {
  int64_t lv = (int64_t)(uint64_t)(l);
  int64_t rv = (int64_t)(uint64_t)(r);
  if (lv < rv)
    return -1;
  else if (lv == rv)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<int64_comparator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    113a <int64_comparator+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    115b <int64_comparator+0x5b>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    1154 <int64_comparator+0x54>
movl   $0x0,-0x4(%rbp)
jmp    115b <int64_comparator+0x5b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int64_comparator>:
movslq %edi,%rax
movslq %esi,%rcx
xor    %edx,%edx
cmp    %rcx,%rax
setne  %dl
mov    $0xffffffff,%eax
cmovge %edx,%eax
ret

LLVM IR (-O0):
define i32 @int64_comparator(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = ptrtoint i8* %8 to i32
%10 = sext i32 %9 to i64
store i64 %10, i64* %6
%11 = load i8*, i8** %5
%12 = ptrtoint i8* %11 to i32
%13 = sext i32 %12 to i64
store i64 %13, i64* %7
%14 = load i64, i64* %6
%15 = load i64, i64* %7
%16 = icmp slt i64 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %24
18: ; preds = %2
%19 = load i64, i64* %6
%20 = load i64, i64* %7
%21 = icmp eq i64 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 0, i32* %3
br label %24
23: ; preds = %18
store i32 1, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @int64_comparator(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = shl i64 %3, 32
%5 = ashr exact i64 %4, 32
%6 = ptrtoint i8* %1 to i64
%7 = shl i64 %6, 32
%8 = ashr exact i64 %7, 32
%9 = icmp slt i64 %5, %8
%10 = icmp ne i64 %5, %8
%11 = zext i1 %10 to i32
%12 = select i1 %9, i32 -1, i32 %11
ret i32 %12
}
/* Variables and functions */
int chdir(char *);
int /*<<< orphan*/ printf(char *);
void change_dir(char *path) {
  int chdir_status;
  chdir_status = chdir(path);
  if (chdir_status != 0)
    printf("Error: Invalid directory path.\n");
}


x86 assembly (clang, -O0):
<change_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <chdir@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114e <change_dir+0x2e>
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<change_dir>:
push   %rax
call   1040 <chdir@plt>
test   %eax,%eax
je     1137 <change_dir+0x17>
lea    0xecf(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Error: Invalid directory path.\0A\00"
define void @change_dir(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @chdir(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"Error: Invalid directory path.\00"
define void @change_dir(i8* %0) {
%2 = tail call i32 @chdir(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
scalar_t__ alloca(int);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void func(void) {
  int sz;
  char *buf;
  scanf("%d", &sz);
  buf = (char *)alloca(sz);
  gets(buf);
  printf(buf);
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1040 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <gets@plt>
mov    -0x10(%rbp),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
call   1040 <alloca@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @func() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i64 @alloca(i32 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @gets(i8* %7)
%9 = load i8*, i8** %2
%10 = call i32 @printf(i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @func() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i64 @alloca(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = call i32 @gets(i8* %6)
%8 = call i32 @printf(i8* dereferenceable(1) %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ die();
int /*<<< orphan*/ perror(char const *);
void bail(const char *n) {
  perror(n);
  die();
}


x86 assembly (clang, -O0):
<bail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    $0x0,%al
call   1030 <die@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bail>:
push   %rax
call   1040 <perror@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <die@plt>

LLVM IR (-O0):
define void @bail(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 (...) @die()
ret void
}

LLVM IR (-O2):
define void @bail(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 (...) @die()
ret void
}
/* Variables and functions */
int log(int);
int /*<<< orphan*/ printf(char *, int);
int strtod(char *, int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  printf("%d\n", 1 + (int)(log(strtod(argv[1], NULL)) / log(2)));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
mov    %eax,%edi
call   1050 <log@plt>
mov    %eax,-0x14(%rbp)
mov    $0x2,%edi
call   1050 <log@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%esi
add    $0x1,%esi
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
mov    %eax,%edi
call   1050 <log@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   1050 <log@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
lea    0x1(%rax),%esi
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %4
%6 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = load i8*, i8** %6
%8 = call i32 @strtod(i8* %7, i32* null)
%9 = call i32 @log(i32 %8)
%10 = call i32 @log(i32 2)
%11 = sdiv i32 %9, %10
%12 = add nsw i32 1, %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @strtod(i8* nocapture %4, i32* null)
%6 = tail call i32 @log(i32 %5)
%7 = tail call i32 @log(i32 2)
%8 = sdiv i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Type definitions */
struct utsname {
  int /*<<< orphan*/ nodename;
};

/* Variables and functions */
char *strdup(int /*<<< orphan*/);
int /*<<< orphan*/ uname(struct utsname *);
char *get_node_name() {
  struct utsname name;
  uname(&name);
  return strdup(name.nodename);
}


x86 assembly (clang, -O0):
<get_node_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <uname@plt>
mov    -0x8(%rbp),%edi
call   1040 <strdup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_node_name>:
push   %rax
mov    %rsp,%rdi
call   1030 <uname@plt>
mov    (%rsp),%edi
pop    %rax
jmp    1040 <strdup@plt>

LLVM IR (-O0):
%struct.utsname = type { i32 }
define i8* @get_node_name() {
%1 = alloca %struct.utsname
%2 = call i32 @uname(%struct.utsname* %1)
%3 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = call i8* @strdup(i32 %4)
ret i8* %5
}

LLVM IR (-O2):
%struct.utsname = type { i32 }
define i8* @get_node_name() {
%1 = alloca %struct.utsname
%2 = bitcast %struct.utsname* %1 to i8*
%3 = call i32 @uname(%struct.utsname* %1)
%4 = getelementptr inbounds %struct.utsname, %struct.utsname* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = tail call i8* @strdup(i32 %5)
ret i8* %6
}