xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ getline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
main() {
  char line[10];
  while (getline(line, 10) > 0)
    printf("%s", line);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
mov    $0xa,%esi
call   1040 <getline@plt>
cmp    $0x0,%rax
jle    115c <main+0x3c>
lea    -0xe(%rbp),%rsi
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe(%rsp),%rdi
mov    $0xa,%esi
call   1040 <getline@plt>
test   %rax,%rax
jle    116d <main+0x4d>
lea    0xebe(%rip),%r14
lea    0xe(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <getline@plt>
test   %rax,%rax
jg     1150 <main+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i64 @getline(i8* %2, i32 10)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0, %5
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = call i64 @getline(i8* %2, i32 10)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %5, label %9
9: ; preds = %5, %0
ret i32 0
}
int comp_int(void *ref_data, void *new_data) {
  return ((*(int *)(ref_data)) - (*(int *)(new_data)));
}


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

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

LLVM IR (-O0):
define i32 @comp_int(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%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 @comp_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
int rangeBitwiseAnd(int m, int n) {
  int changed = m ^ n;
  int count = 0;
  for (; changed > 0; changed = changed >> 1, count++)
    ;
  return m >> count << count;
}


x86 assembly (clang, -O0):
<rangeBitwiseAnd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1140 <rangeBitwiseAnd+0x40>
jmp    1129 <rangeBitwiseAnd+0x29>
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111a <rangeBitwiseAnd+0x1a>
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%ecx
sar    %cl,%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rangeBitwiseAnd>:
mov    %edi,%eax
xor    %ecx,%ecx
xor    %edi,%esi
jle    111c <rangeBitwiseAnd+0x1c>
mov    %esi,%edx
nopw   0x0(%rax,%rax,1)
shr    %edx
add    $0x1,%ecx
cmp    $0x1,%esi
mov    %edx,%esi
ja     1110 <rangeBitwiseAnd+0x10>
shr    %cl,%eax
shl    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @rangeBitwiseAnd(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %2, %5
%6 = phi i32 [ %9, %5 ], [ 0, %2 ]
%7 = phi i32 [ %8, %5 ], [ %3, %2 ]
%8 = lshr i32 %7, 1
%9 = add nuw nsw i32 %6, 1
%10 = icmp ult i32 %7, 2
br i1 %10, label %11, label %5
11: ; preds = %5, %2
%12 = phi i32 [ 0, %2 ], [ %9, %5 ]
%13 = shl nsw i32 -1, %12
%14 = and i32 %13, %0
ret i32 %14
}
/* Type definitions */
struct wpcp_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct wpcp_t *);
void wpcp_delete(struct wpcp_t *wpcp) { free(wpcp); }


x86 assembly (clang, -O0):
<wpcp_delete>:
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):
<wpcp_delete>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.wpcp_t = type { i32 }
define void @wpcp_delete(%struct.wpcp_t* nocapture %0) {
%2 = tail call i32 @free(%struct.wpcp_t* %0)
ret void
}
long SCE_Decode_Long(const unsigned char *data) {
  long id;
  id = (unsigned char)data[0];
  id |= ((unsigned char)data[1] << 8);
  id |= ((unsigned char)data[2] << 16);
  id |= ((unsigned char)data[3] << 24);
  return id;
}


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

x86 assembly (clang, -O2):
<SCE_Decode_Long>:
movzwl (%rdi),%eax
movzbl 0x2(%rdi),%ecx
shl    $0x10,%rcx
or     %rax,%rcx
movzbl 0x3(%rdi),%eax
shl    $0x18,%eax
cltq
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @SCE_Decode_Long(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
store i64 %7, i64* %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = sext i32 %12 to i64
%14 = load i64, i64* %3
%15 = or i64 %14, %13
store i64 %15, i64* %3
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 2
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 16
%21 = sext i32 %20 to i64
%22 = load i64, i64* %3
%23 = or i64 %22, %21
store i64 %23, i64* %3
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i64 3
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = shl i32 %27, 24
%29 = sext i32 %28 to i64
%30 = load i64, i64* %3
%31 = or i64 %30, %29
store i64 %31, i64* %3
%32 = load i64, i64* %3
ret i64 %32
}

LLVM IR (-O2):
define i64 @SCE_Decode_Long(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i64
%7 = shl nuw nsw i64 %6, 8
%8 = or i64 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i64
%12 = shl nuw nsw i64 %11, 16
%13 = or i64 %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 = sext i32 %17 to i64
%19 = or i64 %13, %18
ret i64 %19
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *);
int /*<<< orphan*/ stderr;
void rtpp_stats_nstr_fin(void *pub) {
  fprintf(stderr,
          "Method rtpp_stats@%p::nstr (rtpp_stats_nstr) is invoked after "
          "destruction\x0a",
          pub);
  abort();
}


x86 assembly (clang, -O0):
<rtpp_stats_nstr_fin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<rtpp_stats_nstr_fin>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [75 x i8] c"Method rtpp_stats@%p::nstr (rtpp_stats_nstr) is invoked after destruction\0A\00"
define void @rtpp_stats_nstr_fin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [75 x i8] c"Method rtpp_stats@%p::nstr (rtpp_stats_nstr) is invoked after destruction\0A\00"
define void @rtpp_stats_nstr_fin(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
unsigned long GPIOGetIntNumber(unsigned long);
int /*<<< orphan*/ IntEnable(unsigned long);
int /*<<< orphan*/ IntRegister(unsigned long, void (*)());
void GPIOPortIntRegister(unsigned long ulPort, void (*pfnIntHandler)(void)) {
  ;
  ulPort = GPIOGetIntNumber(ulPort);
  IntRegister(ulPort, pfnIntHandler);
  IntEnable(ulPort);
}


x86 assembly (clang, -O0):
<GPIOPortIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <GPIOGetIntNumber@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <IntRegister@plt>
mov    -0x8(%rbp),%rdi
call   1030 <IntEnable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIOPortIntRegister>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <GPIOGetIntNumber@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <IntRegister@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @GPIOPortIntRegister(i64 %0, void ()* %1) {
%3 = alloca i64
%4 = alloca void ()*
store i64 %0, i64* %3
store void ()* %1, void ()** %4
%5 = load i64, i64* %3
%6 = call i64 @GPIOGetIntNumber(i64 %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = load void ()*, void ()** %4
%9 = bitcast void ()* %8 to void (...)*
%10 = call i32 @IntRegister(i64 %7, void (...)* %9)
%11 = load i64, i64* %3
%12 = call i32 @IntEnable(i64 %11)
ret void
}

LLVM IR (-O2):
define void @GPIOPortIntRegister(i64 %0, void ()* %1) {
%3 = tail call i64 @GPIOGetIntNumber(i64 %0)
%4 = bitcast void ()* %1 to void (...)*
%5 = tail call i32 @IntRegister(i64 %3, void (...)* %4)
%6 = tail call i32 @IntEnable(i64 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lower_to_upper(char *);
int main() { lower_to_upper("anneanneanne"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <lower_to_upper@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <lower_to_upper@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"anneanneanne\00"
define i32 @main() {
%1 = call i32 @lower_to_upper(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"anneanneanne\00"
define i32 @main() {
%1 = tail call i32 @lower_to_upper(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct wl_resource {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ wl_resource_post_event(struct wl_resource *, int,
                                          int /*<<< orphan*/,
                                          int /*<<< orphan*/,
                                          int /*<<< orphan*/);
void wl_touch_send_up(struct wl_resource *resource_, uint32_t serial,
                      uint32_t time, int32_t id) {
  wl_resource_post_event(resource_, 1, serial, time, id);
}


x86 assembly (clang, -O0):
<wl_touch_send_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    $0x1,%esi
call   1030 <wl_resource_post_event@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_touch_send_up>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    $0x1,%esi
jmp    1030 <wl_resource_post_event@plt>

LLVM IR (-O0):
%struct.wl_resource = type { i32 }
define void @wl_touch_send_up(%struct.wl_resource* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.wl_resource*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.wl_resource* %0, %struct.wl_resource** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.wl_resource*, %struct.wl_resource** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @wl_resource_post_event(%struct.wl_resource* %9, i32 1, i32 %10, i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
%struct.wl_resource = type { i32 }
define void @wl_touch_send_up(%struct.wl_resource* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @wl_resource_post_event(%struct.wl_resource* %0, i32 1, i32 %1, i32 %2, i32 %3)
ret void
}
void restore_rgb_config(void) {}


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

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

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

LLVM IR (-O2):
define void @restore_rgb_config() {
ret void
}
int next_digits_factorial_num(int value) {
  static const int factorials[] = {1,   1,   2,    6,     24,
                                   120, 720, 5040, 40320, 362880};
  int next = 0;
  while (value > 0) {
    int digit = value % 10;
    value /= 10;
    next += factorials[digit];
  }
  return next;
}


x86 assembly (clang, -O0):
<next_digits_factorial_num>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    114d <next_digits_factorial_num+0x4d>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
movslq -0xc(%rbp),%rcx
lea    0xec1(%rip),%rax
mov    (%rax,%rcx,4),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110e <next_digits_factorial_num+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_digits_factorial_num>:
xor    %eax,%eax
test   %edi,%edi
jle    113f <next_digits_factorial_num+0x3f>
mov    $0xcccccccd,%r8d
lea    0xeed(%rip),%r9
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %edi,%esi
imul   %r8,%rsi
shr    $0x23,%rsi
lea    (%rsi,%rsi,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %edi,%edx
sub    %ecx,%edx
add    (%r9,%rdx,4),%eax
cmp    $0x9,%edi
mov    %esi,%edi
ja     1120 <next_digits_factorial_num+0x20>
ret

LLVM IR (-O0):
@next_digits_factorial_num.factorials = internal constant [10 x i32] [i32 1, i32 1, i32 2, i32 6, i32 24, i32 120, i32 720, i32 5040, i32 40320, i32 362880]
define i32 @next_digits_factorial_num(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %8, %1
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = load i32, i32* %2
%10 = srem i32 %9, 10
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 10
store i32 %12, i32* %2
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* @next_digits_factorial_num.factorials, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = load i32, i32* %3
%18 = add nsw i32 %17, %16
store i32 %18, i32* %3
br label %5
19: ; preds = %5
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@next_digits_factorial_num.factorials = internal unnamed_addr constant [10 x i32] [i32 1, i32 1, i32 2, i32 6, i32 24, i32 120, i32 720, i32 5040, i32 40320, i32 362880]
define i32 @next_digits_factorial_num(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %13
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = phi i32 [ %11, %3 ], [ 0, %1 ]
%6 = urem i32 %4, 10
%7 = udiv i32 %4, 10
%8 = zext i32 %6 to i64
%9 = getelementptr inbounds [10 x i32], [10 x i32]* @next_digits_factorial_num.factorials, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = add nsw i32 %10, %5
%12 = icmp ult i32 %4, 10
br i1 %12, label %13, label %3
13: ; preds = %3, %1
%14 = phi i32 [ 0, %1 ], [ %11, %3 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void main(void) {
  int a = 0;
  while (a < 255) {
    a = a + 1;
    printf("\n %d %c", a, a);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jge    114c <main+0x3c>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    111f <main+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"\0A %d %c\00"
define void @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %3, %1 ]
%3 = add nuw nsw i32 %2, 1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %3)
%5 = icmp eq i32 %3, 255
br i1 %5, label %6, label %1
6: ; preds = %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fwrite(float *, int, int, int /*<<< orphan*/ *);
void save_bin(const char *file_name, float *rst, int num) {
  FILE *fp = fopen(file_name, "wb");
  fwrite(rst, num, sizeof(float), fp);
  fclose(fp);
}


x86 assembly (clang, -O0):
<save_bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    $0x4,%edx
call   1050 <fwrite@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_bin>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
lea    0xebf(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x4,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"wb\00"
define void @save_bin(i8* %0, float* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca float*
%6 = alloca i32
%7 = alloca i32*
store i8* %0, i8** %4
store float* %1, float** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %7
%10 = load float*, float** %5
%11 = load i32, i32* %6
%12 = load i32*, i32** %7
%13 = call i32 @fwrite(float* %10, i32 %11, i32 4, i32* %12)
%14 = load i32*, i32** %7
%15 = call i32 @fclose(i32* %14)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"wb\00"
define void @save_bin(i8* nocapture %0, float* nocapture %1, i32 %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @fwrite(float* %1, i32 %2, i32 4, i32* %4)
%6 = tail call i32 @fclose(i32* %4)
ret void
}
int CalcConDelay(int attempt) {
  if (attempt <= 3)
    return (10);
  return (attempt * attempt);
}


x86 assembly (clang, -O0):
<CalcConDelay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jg     111d <CalcConDelay+0x1d>
movl   $0xa,-0x4(%rbp)
jmp    1127 <CalcConDelay+0x27>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalcConDelay>:
mov    %edi,%ecx
imul   %edi,%ecx
cmp    $0x4,%edi
mov    $0xa,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @CalcConDelay(i32 %0) {
%2 = icmp slt i32 %0, 4
%3 = mul nsw i32 %0, %0
%4 = select i1 %2, i32 10, i32 %3
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t clamp_8bit(int val) {
  if (val > 255)
    return 255;
  else if (val < 0)
    return 0;
  else
    return (uint8_t)val;
}


x86 assembly (clang, -O0):
<clamp_8bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jle    1120 <clamp_8bit+0x20>
movl   $0xff,-0x4(%rbp)
jmp    113c <clamp_8bit+0x3c>
cmpl   $0x0,-0x8(%rbp)
jge    1136 <clamp_8bit+0x36>
movl   $0x0,-0x4(%rbp)
jmp    113c <clamp_8bit+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp_8bit>:
xor    %ecx,%ecx
test   %edi,%edi
cmovns %edi,%ecx
cmp    $0xff,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @clamp_8bit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 255
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 255, i32* %2
br label %13
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 0, i32* %2
br label %13
11: ; preds = %7
%12 = load i32, i32* %3
store i32 %12, i32* %2
br label %13
13: ; preds = %11, %10, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @clamp_8bit(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
%4 = icmp ult i32 %3, 255
%5 = select i1 %4, i32 %3, i32 255
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ Hardware_Init();
int /*<<< orphan*/ Library_Init();
int main(void) {
  Hardware_Init();
  Library_Init();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <Hardware_Init@plt>
mov    $0x0,%al
call   1040 <Library_Init@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <Hardware_Init@plt>
xor    %eax,%eax
call   1040 <Library_Init@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @Hardware_Init()
%2 = tail call i32 (...) @Library_Init()
ret i32 0
}
int arraylist_cmp_default_cb(void *data, struct t_arraylist *arraylist,
                             void *pointer1, void *pointer2) {
  (void)data;
  (void)arraylist;
  if (pointer1 < pointer2)
    return -1;
  if (pointer1 > pointer2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<arraylist_cmp_default_cb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    112e <arraylist_cmp_default_cb+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    114f <arraylist_cmp_default_cb+0x4f>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jbe    1148 <arraylist_cmp_default_cb+0x48>
movl   $0x1,-0x4(%rbp)
jmp    114f <arraylist_cmp_default_cb+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<arraylist_cmp_default_cb>:
xor    %esi,%esi
cmp    %rcx,%rdx
seta   %sil
mov    $0xffffffff,%eax
cmovae %esi,%eax
ret

LLVM IR (-O0):
%struct.t_arraylist = type opaque
define i32 @arraylist_cmp_default_cb(i8* %0, %struct.t_arraylist* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca %struct.t_arraylist*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %6
store %struct.t_arraylist* %1, %struct.t_arraylist** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%10 = load i8*, i8** %6
%11 = load %struct.t_arraylist*, %struct.t_arraylist** %7
%12 = load i8*, i8** %8
%13 = load i8*, i8** %9
%14 = icmp ult i8* %12, %13
br i1 %14, label %15, label %16
15: ; preds = %4
store i32 -1, i32* %5
br label %22
16: ; preds = %4
%17 = load i8*, i8** %8
%18 = load i8*, i8** %9
%19 = icmp ugt i8* %17, %18
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 1, i32* %5
br label %22
21: ; preds = %16
store i32 0, i32* %5
br label %22
22: ; preds = %21, %20, %15
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
%struct.t_arraylist = type opaque
define i32 @arraylist_cmp_default_cb(i8* nocapture readnone %0, %struct.t_arraylist* nocapture readnone %1, i8* readnone %2, i8* readnone %3) {
%5 = icmp ult i8* %2, %3
%6 = icmp ugt i8* %2, %3
%7 = zext i1 %6 to i32
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ commit_creds(int /*<<< orphan*/);
int /*<<< orphan*/ prepare_kernel_cred(int /*<<< orphan*/);
int __attribute__((regparm(3))) getroot(void *file, void *vma) {
  commit_creds(prepare_kernel_cred(0));
  return -1;
}


x86 assembly (clang, -O0):
<getroot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <prepare_kernel_cred@plt>
mov    %eax,%edi
call   1040 <commit_creds@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getroot>:
push   %rax
xor    %edi,%edi
call   1030 <prepare_kernel_cred@plt>
mov    %eax,%edi
call   1040 <commit_creds@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @getroot(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 @prepare_kernel_cred(i32 0)
%6 = call i32 @commit_creds(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
define i32 @getroot(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 @prepare_kernel_cred(i32 0)
%4 = tail call i32 @commit_creds(i32 %3)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "usage: mp_task_sim JOB_NUMBER ITERATIONS NUM_THREADS\n");
  exit(EXIT_FAILURE);
}


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    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [54 x i8] c"usage: mp_task_sim JOB_NUMBER ITERATIONS NUM_THREADS\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [54 x i8] c"usage: mp_task_sim JOB_NUMBER ITERATIONS NUM_THREADS\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
int setlogmask(int i) {}


x86 assembly (clang, -O0):
<setlogmask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @setlogmask(i32 %0) {
ret i32 undef
}
void rop3_50_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = T | S;
  stk2 = *D | stk3;
  stk1 = S ^ stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_50_0_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 -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%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_50_0_1>:
mov    %edx,%eax
or     %sil,%al
mov    (%rdi),%r8b
or     %r8b,%al
xor    %sil,%al
mov    %edx,%ecx
not    %cl
or     %sil,%cl
and    %al,%cl
not    %sil
and    %dl,%sil
and    %r8b,%sil
or     %cl,%sil
mov    %sil,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_50_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = or i8 %2, %1
%5 = load i8, i8* %0
%6 = or i8 %4, %5
%7 = xor i8 %6, %1
%8 = xor i8 %2, -1
%9 = or i8 %8, %1
%10 = and i8 %7, %9
%11 = xor i8 %1, -1
%12 = and i8 %11, %2
%13 = and i8 %12, %5
%14 = or i8 %10, %13
store i8 %14, i8* %0
ret void
}
void clock_update() {}


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

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

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

LLVM IR (-O2):
define void @clock_update() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int ferror(FILE *f) { return EOF; }


x86 assembly (clang, -O0):
<ferror>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ferror>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @ferror(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @EOF
ret i32 %3
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @ferror(i32* nocapture readnone %0) {
%2 = load i32, i32* @EOF
ret i32 %2
}
int Cyc_Core_nptrcmp(void *a, void *b) {
  if (a == b)
    return 0;
  if (a > b)
    return 1;
  return -1;
}


x86 assembly (clang, -O0):
<Cyc_Core_nptrcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1126 <Cyc_Core_nptrcmp+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1147 <Cyc_Core_nptrcmp+0x47>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1140 <Cyc_Core_nptrcmp+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1147 <Cyc_Core_nptrcmp+0x47>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Core_nptrcmp>:
xor    %ecx,%ecx
xor    %eax,%eax
cmp    %rsi,%rdi
seta   %al
lea    -0x1(%rax,%rax,1),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Cyc_Core_nptrcmp(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = icmp ugt i8* %0, %1
%5 = select i1 %4, i32 1, i32 -1
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *realloc(void *, size_t);
void *reallocf(void *ptr, size_t size) {
  void *nptr;
  nptr = realloc(ptr, size);
  if (!nptr && ptr)
    free(ptr);
  return (nptr);
}


x86 assembly (clang, -O0):
<reallocf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1160 <reallocf+0x40>
cmpq   $0x0,-0x8(%rbp)
je     1160 <reallocf+0x40>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocf>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1141 <reallocf+0x21>
test   %r14,%r14
jne    1141 <reallocf+0x21>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define noalias i8* @reallocf(i8* %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i8* %0, null
%6 = and i1 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @free(i8* %0)
br label %9
9: ; preds = %7, %2
ret i8* %3
}
int main() {
  int i, *ptr;
  i = 20;
  ptr = &i;
  printf("%d\n", i);
  printf("%d\n", &i);
  printf("%d\n", *ptr);
  printf("%d\n", ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x14,0x4(%rsp)
lea    0xedd(%rip),%rbx
mov    %rbx,%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
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 20, i32* %2
store i32* %2, i32** %3
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32*, i32** %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 20, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 20)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
ret i32 0
}
/* Type definitions */
struct Food {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct Food *);
void food_delete(struct Food *food) { free(food); }


x86 assembly (clang, -O0):
<food_delete>:
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):
<food_delete>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.Food = type { i32 }
define void @food_delete(%struct.Food* nocapture %0) {
%2 = tail call i32 @free(%struct.Food* %0)
ret void
}
char *ae_api_name(void) { return "poll"; }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"poll\00"
define i8* @ae_api_name() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [5 x i8] c"poll\00"
define i8* @ae_api_name() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ nest2xyf(long, long, int *, int *, int *);
long xyf2ring(long, int, int, int);
long nest2ring_(long nside, long ipnest) {
  int ix, iy, face_num;
  if ((nside & (nside - 1)) != 0) {
    return -1;
  }
  nest2xyf(nside, ipnest, &ix, &iy, &face_num);
  return xyf2ring(nside, ix, iy, face_num);
}


x86 assembly (clang, -O0):
<nest2ring_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     1156 <nest2ring_+0x36>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1185 <nest2ring_+0x65>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
call   1040 <nest2xyf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
call   1030 <xyf2ring@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nest2ring_>:
lea    -0x1(%rdi),%rcx
mov    $0xffffffffffffffff,%rax
test   %rcx,%rdi
jne    1165 <nest2ring_+0x45>
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
call   1040 <nest2xyf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
mov    %rbx,%rdi
call   1030 <xyf2ring@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @nest2ring_(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i64 %0, i64* %4
store i64 %1, i64* %5
%9 = load i64, i64* %4
%10 = load i64, i64* %4
%11 = sub nsw i64 %10, 1
%12 = and i64 %9, %11
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %2
store i64 -1, i64* %3
br label %24
15: ; preds = %2
%16 = load i64, i64* %4
%17 = load i64, i64* %5
%18 = call i32 @nest2xyf(i64 %16, i64 %17, i32* %6, i32* %7, i32* %8)
%19 = load i64, i64* %4
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = call i64 @xyf2ring(i64 %19, i32 %20, i32 %21, i32 %22)
store i64 %23, i64* %3
br label %24
24: ; preds = %15, %14
%25 = load i64, i64* %3
ret i64 %25
}

LLVM IR (-O2):
define i64 @nest2ring_(i64 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = tail call i64 @llvm.ctpop.i64(i64 %0)
%10 = icmp ult i64 %9, 2
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = call i32 @nest2xyf(i64 %0, i64 %1, i32* %3, i32* %4, i32* %5)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i64 @xyf2ring(i64 %0, i32 %13, i32 %14, i32 %15)
br label %17
17: ; preds = %2, %11
%18 = phi i64 [ %16, %11 ], [ -1, %2 ]
ret i64 %18
}
int fun764() { return 764; }


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

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

LLVM IR (-O0):
define i32 @fun764() {
ret i32 764
}

LLVM IR (-O2):
define i32 @fun764() {
ret i32 764
}
/* Variables and functions */
scalar_t__ roundf(float);
long int lroundf(float x) { return (long int)roundf(x); }


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

x86 assembly (clang, -O2):
<lroundf>:
jmp    1030 <roundf@plt>

LLVM IR (-O0):
define i64 @lroundf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @roundf(float %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @lroundf(float %0) {
%2 = tail call i64 @roundf(float %0)
ret i64 %2
}
void element2ESC() {}


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

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

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

LLVM IR (-O2):
define void @element2ESC() {
ret void
}
/* Variables and functions */
scalar_t__ remove(char *);
extern int string_NativeString_NativeString_file_delete_0(char *f) {
  return (remove(f) == 0);
}


x86 assembly (clang, -O0):
<string_NativeString_NativeString_file_delete_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_NativeString_NativeString_file_delete_0>:
push   %rax
call   1030 <remove@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @string_NativeString_NativeString_file_delete_0(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @remove(i8* %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @string_NativeString_NativeString_file_delete_0(i8* nocapture %0) {
%2 = tail call i64 @remove(i8* %0)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int test_imm_5Buint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x5B << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_5Buint64_lowword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
and    $0x5b,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_5Buint64_lowword_mem>:
testb  $0x5b,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_5Buint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 91
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_5Buint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 91
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void store64_reverse_1(long long *p, long long x) { *p = __builtin_bswap64(x); }


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

x86 assembly (clang, -O2):
<store64_reverse_1>:
bswap  %rsi
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
define void @store64_reverse_1(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 = call i64 @llvm.bswap.i64(i64 %5)
%7 = load i64*, i64** %3
store i64 %6, i64* %7
ret void
}

LLVM IR (-O2):
define void @store64_reverse_1(i64* nocapture writeonly %0, i64 %1) {
%3 = tail call i64 @llvm.bswap.i64(i64 %1)
store i64 %3, i64* %0
ret void
}