xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ smb2c_irqDisable();
int /*<<< orphan*/ smb2c_irqEnable();
void m43setParams4122(uint16_t addr, uint8_t val) {
  (void)addr;
  if (val & 1)
    smb2c_irqEnable();
  else
    smb2c_irqDisable();
}


x86 assembly (clang, -O0):
<m43setParams4122>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1149 <m43setParams4122+0x29>
mov    $0x0,%al
call   1030 <smb2c_irqEnable@plt>
jmp    1150 <m43setParams4122+0x30>
mov    $0x0,%al
call   1040 <smb2c_irqDisable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m43setParams4122>:
xor    %eax,%eax
test   $0x1,%sil
jne    112d <m43setParams4122+0xd>
jmp    1040 <smb2c_irqDisable@plt>
jmp    1030 <smb2c_irqEnable@plt>

LLVM IR (-O0):
define void @m43setParams4122(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 = and i32 %6, 1
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @smb2c_irqEnable()
br label %13
11: ; preds = %2
%12 = call i32 (...) @smb2c_irqDisable()
br label %13
13: ; preds = %11, %9
ret void
}

LLVM IR (-O2):
define void @m43setParams4122(i32 %0, i32 %1) {
%3 = and i32 %1, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @smb2c_irqEnable()
br label %9
7: ; preds = %2
%8 = tail call i32 (...) @smb2c_irqDisable()
br label %9
9: ; preds = %7, %5
ret void
}
/* Variables and functions */
void free(void *);
extern void image2screen_freebuf(void *buf) { return free(buf); }


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

LLVM IR (-O0):
define void @image2screen_freebuf(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @image2screen_freebuf(i8* nocapture %0) {
tail call void @free(i8* %0)
ret void
}
/* Variables and functions */
int current_setting(char *);
int /*<<< orphan*/ set_setting(char *, int);
int toggle_setting(char *path) {
  int previous = current_setting(path);
  if (previous) {
    set_setting(path, 0);
  } else {
    set_setting(path, 1);
  }
  return previous;
}


x86 assembly (clang, -O0):
<toggle_setting>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <current_setting@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1152 <toggle_setting+0x32>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <set_setting@plt>
jmp    1160 <toggle_setting+0x40>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <set_setting@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toggle_setting>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <current_setting@plt>
mov    %eax,%ebp
xor    %esi,%esi
test   %eax,%eax
sete   %sil
mov    %rbx,%rdi
call   1030 <set_setting@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @toggle_setting(i8* %0) {
%2 = tail call i32 @current_setting(i8* %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @set_setting(i8* %0, i32 %4)
ret i32 %2
}
unsigned int get_int_seg(int i) { return *(unsigned short *)(i * 4 + 2); }


x86 assembly (clang, -O0):
<get_int_seg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
add    $0x2,%eax
cltq
movzwl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int_seg>:
shl    $0x2,%edi
movslq %edi,%rax
movzwl 0x2(%rax),%eax
ret

LLVM IR (-O0):
define i32 @get_int_seg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 4
%5 = add nsw i32 %4, 2
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i16*
%8 = load i16, i16* %7
%9 = zext i16 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_int_seg(i32 %0) {
%2 = shl nsw i32 %0, 2
%3 = or i32 %2, 2
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i16*
%6 = load i16, i16* %5
%7 = zext i16 %6 to i32
ret i32 %7
}
unsigned xrop3_249_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = D ^ S;
  stk2 = ~stk2;
  stk1 = T | stk2;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_249_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_249_0_0>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
xor    $0xffffff00,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @xrop3_249_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %4, -256
%8 = or i32 %6, %7
ret i32 %8
}
void myAsm(char *str) {}


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

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

LLVM IR (-O0):
define void @myAsm(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @myAsm(i8* nocapture %0) {
ret void
}
char *stringify_int(long v, char *p) {
  *p = '\0';
  do {
    --p;
    *p = v % 10 + '0';
    v /= 10;
  } while (v);
  return p;
}


x86 assembly (clang, -O0):
<stringify_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
add    $0x30,%rdx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1113 <stringify_int+0x13>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringify_int>:
movb   $0x0,(%rsi)
movabs $0x6666666666666667,%r8
66 66 66
nopl   (%rax)
mov    %rdi,%rax
imul   %r8
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %edi,%ecx
sub    %eax,%ecx
add    $0x30,%cl
mov    %cl,-0x1(%rsi)
add    $0xffffffffffffffff,%rsi
add    $0x9,%rdi
cmp    $0x12,%rdi
mov    %rdx,%rdi
ja     1110 <stringify_int+0x10>
mov    %rsi,%rax
ret

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

LLVM IR (-O2):
define i8* @stringify_int(i64 %0, i8* writeonly %1) {
store i8 0, i8* %1
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %0, %2 ], [ %10, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 -1
%7 = srem i64 %4, 10
%8 = trunc i64 %7 to i8
%9 = add nsw i8 %8, 48
store i8 %9, i8* %6
%10 = sdiv i64 %4, 10
%11 = add i64 %4, 9
%12 = icmp ult i64 %11, 19
br i1 %12, label %13, label %3
13: ; preds = %3
ret i8* %6
}
/* Variables and functions */
int cupkee_module_export(void *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ val_mk_number(double);
int cupkee_module_export_number(void *m, const char *k, double v) {
  return cupkee_module_export(m, k, val_mk_number(v));
}


x86 assembly (clang, -O0):
<cupkee_module_export_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <val_mk_number@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <cupkee_module_export@plt>
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @cupkee_module_export_number(i8* %0, i8* %1, double %2) {
%4 = tail call i32 @val_mk_number(double %2)
%5 = tail call i32 @cupkee_module_export(i8* %0, i8* %1, i32 %4)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ eventfd_t;
typedef int /*<<< orphan*/ counter;

/* Variables and functions */
int write(int, int /*<<< orphan*/ *, int);
int eventfd_write(int fd, eventfd_t counter) {
  int ret = write(fd, &counter, sizeof(counter));
  if (ret == sizeof(counter))
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<eventfd_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    %eax,-0x10(%rbp)
movslq -0x10(%rbp),%rax
cmp    $0x4,%rax
jne    114c <eventfd_write+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1153 <eventfd_write+0x43>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eventfd_write>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
xor    %ecx,%ecx
cmp    $0x4,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @eventfd_write(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = call i32 @write(i32 %7, i32* %5, i32 4)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = icmp eq i64 %10, 4
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @eventfd_write(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @write(i32 %0, i32* %3, i32 4)
%5 = icmp ne i32 %4, 4
%6 = sext i1 %5 to i32
ret i32 %6
}
void vid_vsync_post(void) {
  while (*(volatile unsigned short *)0x04000006 < 160)
    ;
}


x86 assembly (clang, -O0):
<vid_vsync_post>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <vid_vsync_post+0x9>
mov    $0x4000006,%eax
mov    (%rax),%ax
movzwl %ax,%eax
cmp    $0xa0,%eax
jge    1124 <vid_vsync_post+0x24>
jmp    1109 <vid_vsync_post+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vid_vsync_post>:
movzwl 0x4000006,%eax
04
cmp    $0xa0,%eax
jb     1100 <vid_vsync_post>
ret

LLVM IR (-O0):
define void @vid_vsync_post() {
br label %1
1: ; preds = %5, %0
%2 = load volatile i16, i16* inttoptr (i64 67108870 to i16*)
%3 = zext i16 %2 to i32
%4 = icmp slt i32 %3, 160
br i1 %4, label %5, label %6
5: ; preds = %1
br label %1
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @vid_vsync_post() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i16, i16* inttoptr (i64 67108870 to i16*)
%3 = icmp ult i16 %2, 160
br i1 %3, label %1, label %4
4: ; preds = %1
ret void
}
int mul(int a, int b) { return a * b; }


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

x86 assembly (clang, -O2):
<mul>:
mov    %edi,%eax
imul   %esi,%eax
ret

LLVM IR (-O0):
define i32 @mul(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 = mul nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @mul(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
void COMsync() {}


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

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

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

LLVM IR (-O2):
define void @COMsync() {
ret void
}
void swapArr(int *arr, int oldIndex, int newIndex) {
  int temp = arr[oldIndex];
  arr[oldIndex] = arr[newIndex];
  arr[newIndex] = temp;
}


x86 assembly (clang, -O0):
<swapArr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapArr>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

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

LLVM IR (-O2):
define void @swapArr(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
/* Variables and functions */
scalar_t__ rintf(float);
long long llrintf(float x) { return (long long)rintf(x); }


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

x86 assembly (clang, -O2):
<llrintf>:
jmp    1030 <rintf@plt>

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

LLVM IR (-O2):
define i64 @llrintf(float %0) {
%2 = tail call i64 @rintf(float %0)
ret i64 %2
}
int int_mul(int x, int y) { return x * y; }


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

x86 assembly (clang, -O2):
<int_mul>:
mov    %edi,%eax
imul   %esi,%eax
ret

LLVM IR (-O0):
define i32 @int_mul(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 = mul nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @int_mul(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
/* Type definitions */
struct TreeNode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ helper(struct TreeNode *, int /*<<< orphan*/, int *);
int sumNumbers(struct TreeNode *root) {
  int sum = 0;
  helper(root, 0, &sum);
  return sum;
}


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

x86 assembly (clang, -O2):
<sumNumbers>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdx
xor    %esi,%esi
call   1030 <helper@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TreeNode = type { i32 }
define i32 @sumNumbers(%struct.TreeNode* %0) {
%2 = alloca %struct.TreeNode*
%3 = alloca i32
store %struct.TreeNode* %0, %struct.TreeNode** %2
store i32 0, i32* %3
%4 = load %struct.TreeNode*, %struct.TreeNode** %2
%5 = call i32 @helper(%struct.TreeNode* %4, i32 0, i32* %3)
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
define i32 @sumNumbers(%struct.TreeNode* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @helper(%struct.TreeNode* %0, i32 0, i32* %2)
%5 = load i32, i32* %2
ret i32 %5
}
int main() { return -0 << 3; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0x51() {
  Assert_real((isodigit(81) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isodigit.c",
              410, ("isodigit should be 0 for Q"));
}


x86 assembly (clang, -O0):
<t_isodigit_0x51>:
push   %rbp
mov    %rsp,%rbp
mov    $0x51,%edi
call   1040 <isodigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x19a,%edx
lea    0xf5c(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isodigit_0x51>:
push   %rax
mov    $0x51,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x19a,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [27 x i8] c"isodigit should be 0 for Q\00"
define void @t_isodigit_0x51() {
%1 = call i64 @isodigit(i32 81)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 410, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [27 x i8] c"isodigit should be 0 for Q\00"
define void @t_isodigit_0x51() {
%1 = tail call i64 @isodigit(i32 81)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 410, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int subs_si_test3(int a, int b, int c) {
  int d = a - (b << 3);
  if (d == 0)
    return a + c;
  else
    return b + d + c;
}


x86 assembly (clang, -O0):
<subs_si_test3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1133 <subs_si_test3+0x33>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113f <subs_si_test3+0x3f>
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<subs_si_test3>:
lea    0x0(,%rsi,8),%eax
mov    %edi,%ecx
sub    %eax,%ecx
lea    (%rsi,%rcx,1),%eax
test   %ecx,%ecx
cmove  %edi,%eax
add    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @subs_si_test3(i32 %0, i32 %1, i32 %2) {
%4 = mul i32 %1, -8
%5 = add i32 %4, %0
%6 = icmp eq i32 %5, 0
%7 = add nsw i32 %5, %1
%8 = select i1 %6, i32 %0, i32 %7
%9 = add nsw i32 %8, %2
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ gen(char *);
void cgand(void) { gen("and\tax,cx"); }


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

x86 assembly (clang, -O2):
<cgand>:
lea    0xee9(%rip),%rdi
jmp    1030 <gen@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"and\09ax,cx\00"
define void @cgand() {
%1 = call i32 @gen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"and\09ax,cx\00"
define void @cgand() {
%1 = tail call i32 @gen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned char *__ziplistInsert(unsigned char *, unsigned char *,
                               unsigned char *, unsigned int);
unsigned char *ziplistInsert(unsigned char *zl, unsigned char *p,
                             unsigned char *s, unsigned int slen) {
  return __ziplistInsert(zl, p, s, slen);
}


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

x86 assembly (clang, -O2):
<ziplistInsert>:
jmp    1030 <__ziplistInsert@plt>

LLVM IR (-O0):
define i8* @ziplistInsert(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i8* @__ziplistInsert(i8* %9, i8* %10, i8* %11, i32 %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @ziplistInsert(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i8* @__ziplistInsert(i8* %0, i8* %1, i8* %2, i32 %3)
ret i8* %5
}
/* Variables and functions */
int tty_establish_ppp(int);
int establish_ppp(int fd) { return tty_establish_ppp(fd); }


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

x86 assembly (clang, -O2):
<establish_ppp>:
jmp    1030 <tty_establish_ppp@plt>

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

LLVM IR (-O2):
define i32 @establish_ppp(i32 %0) {
%2 = tail call i32 @tty_establish_ppp(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x1b() {
  Assert_real((isspace(27) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              140, ("isspace should be 0 for 0x1b"));
}


x86 assembly (clang, -O0):
<t_isspace_0x1b>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1b,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x8c,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isspace_0x1b>:
push   %rax
mov    $0x1b,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x8c,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0x1b\00"
define void @t_isspace_0x1b() {
%1 = call i64 @isspace(i32 27)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 140, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0x1b\00"
define void @t_isspace_0x1b() {
%1 = tail call i64 @isspace(i32 27)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 140, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void action_nombre_de_transitions(int origine, char lettre, int fin,
                                  void *data) {
  int *nb = (int *)data;
  (*nb) += 1;
}


x86 assembly (clang, -O0):
<action_nombre_de_transitions>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<action_nombre_de_transitions>:
addl   $0x1,(%rcx)
ret

LLVM IR (-O0):
define void @action_nombre_de_transitions(i32 %0, i8 signext %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32*
store i32 %0, i32* %5
store i8 %1, i8* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i8*, i8** %8
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %9
%12 = load i32*, i32** %9
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %12
ret void
}

LLVM IR (-O2):
define void @action_nombre_de_transitions(i32 %0, i8 signext %1, i32 %2, i8* nocapture %3) {
%5 = bitcast i8* %3 to i32*
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 1
store i32 %7, i32* %5
ret void
}
/* Variables and functions */
double acos(double);
int /*<<< orphan*/ printf(char *, double, double);
int main() {
  double x, ret, val;
  x = 0.9;
  val = 180.0 / 3.14159265;
  ret = acos(x) * val;
  printf("The arc cosine of %lf is %lf degrees\n", x, ret);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <acos@plt>
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
movsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"The arc cosine of %lf is %lf degrees\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
store double 9.000000e-01, double* %2
store double 0x404CA5DC1AF05A77, double* %4
%5 = load double, double* %2
%6 = call double @acos(double %5)
%7 = load double, double* %4
%8 = fmul double %6, %7
store double %8, double* %3
%9 = load double, double* %2
%10 = load double, double* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), double %9, double %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"The arc cosine of %lf is %lf degrees\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), double 9.000000e-01, double 0x4039D788E8520EFE)
ret i32 0
}
void *malloc_unwatch(addr) void *addr;
{ return ((void *)0); }


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

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

LLVM IR (-O0):
define i8* @malloc_unwatch(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @malloc_unwatch(i8* nocapture readnone %0) {
ret i8* null
}
double to_radians(double degrees) {
  double radians;
  radians = degrees / 180;
  return (radians *= 3.141592653589793116);
}


x86 assembly (clang, -O0):
<to_radians>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xef2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xed9(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_radians>:
divsd  0xef8(%rip),%xmm0
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @to_radians(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fdiv double %4, 1.800000e+02
store double %5, double* %3
%6 = load double, double* %3
%7 = fmul double %6, 0x400921FB54442D18
store double %7, double* %3
ret double %7
}

LLVM IR (-O2):
define double @to_radians(double %0) {
%2 = fdiv double %0, 1.800000e+02
%3 = fmul double %2, 0x400921FB54442D18
ret double %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void sha1_reverse(uint32_t *hash) {
  hash[4] -= 0xC3D2E1F0;
  hash[4] = (hash[4] << 2) | (hash[4] >> 30);
}


x86 assembly (clang, -O0):
<sha1_reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%ecx
sub    $0xc3d2e1f0,%ecx
mov    %ecx,0x10(%rax)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%ecx
shl    $0x2,%ecx
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
sar    $0x1e,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sha1_reverse>:
mov    $0x3c2d1e10,%eax
add    0x10(%rdi),%eax
lea    0x0(,%rax,4),%ecx
sar    $0x1e,%eax
or     %ecx,%eax
mov    %eax,0x10(%rdi)
ret

LLVM IR (-O0):
define void @sha1_reverse(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 4
%5 = load i32, i32* %4
%6 = sub i32 %5, -1009589776
store i32 %6, i32* %4
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 4
%9 = load i32, i32* %8
%10 = shl i32 %9, 2
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 4
%13 = load i32, i32* %12
%14 = ashr i32 %13, 30
%15 = or i32 %10, %14
%16 = load i32*, i32** %2
%17 = getelementptr inbounds i32, i32* %16, i64 4
store i32 %15, i32* %17
ret void
}

LLVM IR (-O2):
define void @sha1_reverse(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = load i32, i32* %2
%4 = add i32 %3, 1009589776
%5 = shl i32 %4, 2
%6 = ashr i32 %4, 30
%7 = or i32 %5, %6
store i32 %7, i32* %2
ret void
}
/* Type definitions */
union bpf_attr {
  int /*<<< orphan*/ btf_id;
};
typedef int /*<<< orphan*/ attr;
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
int /*<<< orphan*/ BPF_BTF_GET_FD_BY_ID;
int /*<<< orphan*/ memset(union bpf_attr *, int /*<<< orphan*/, int);
int sys_bpf(int /*<<< orphan*/, union bpf_attr *, int);
int bpf_btf_get_fd_by_id(__u32 id) {
  union bpf_attr attr;
  memset(&attr, 0, sizeof(attr));
  attr.btf_id = id;
  return sys_bpf(BPF_BTF_GET_FD_BY_ID, &attr, sizeof(attr));
}


x86 assembly (clang, -O0):
<bpf_btf_get_fd_by_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <sys_bpf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bpf_btf_get_fd_by_id>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    %ebx,(%rsp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <sys_bpf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%union.bpf_attr = type { i32 }
@BPF_BTF_GET_FD_BY_ID = global i32 0
define i32 @bpf_btf_get_fd_by_id(i32 %0) {
%2 = alloca i32
%3 = alloca %union.bpf_attr
store i32 %0, i32* %2
%4 = call i32 @memset(%union.bpf_attr* %3, i32 0, i32 4)
%5 = load i32, i32* %2
%6 = bitcast %union.bpf_attr* %3 to i32*
store i32 %5, i32* %6
%7 = load i32, i32* @BPF_BTF_GET_FD_BY_ID
%8 = call i32 @sys_bpf(i32 %7, %union.bpf_attr* %3, i32 4)
ret i32 %8
}

LLVM IR (-O2):
%union.bpf_attr = type { i32 }
@BPF_BTF_GET_FD_BY_ID = global i32 0
define i32 @bpf_btf_get_fd_by_id(i32 %0) {
%2 = alloca %union.bpf_attr
%3 = bitcast %union.bpf_attr* %2 to i8*
%4 = call i32 @memset(%union.bpf_attr* %2, i32 0, i32 4)
%5 = getelementptr inbounds %union.bpf_attr, %union.bpf_attr* %2, i64 0, i32 0
store i32 %0, i32* %5
%6 = load i32, i32* @BPF_BTF_GET_FD_BY_ID
%7 = call i32 @sys_bpf(i32 %6, %union.bpf_attr* %2, i32 4)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ adc16(int /*<<< orphan*/);
int /*<<< orphan*/ readmemw65816(int /*<<< orphan*/);
int /*<<< orphan*/ zeropagex();
void adcZpx16(void) { adc16(readmemw65816(zeropagex())); }


x86 assembly (clang, -O0):
<adcZpx16>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <zeropagex@plt>
mov    %eax,%edi
call   1030 <readmemw65816@plt>
mov    %eax,%edi
call   1050 <adc16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<adcZpx16>:
push   %rax
xor    %eax,%eax
call   1040 <zeropagex@plt>
mov    %eax,%edi
call   1030 <readmemw65816@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <adc16@plt>

LLVM IR (-O0):
define void @adcZpx16() {
%1 = call i32 (...) @zeropagex()
%2 = call i32 @readmemw65816(i32 %1)
%3 = call i32 @adc16(i32 %2)
ret void
}

LLVM IR (-O2):
define void @adcZpx16() {
%1 = tail call i32 (...) @zeropagex()
%2 = tail call i32 @readmemw65816(i32 %1)
%3 = tail call i32 @adc16(i32 %2)
ret void
}
int handle_options(const char *argv[]) { return 1; }


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

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

LLVM IR (-O0):
define i32 @handle_options(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
ret i32 1
}

LLVM IR (-O2):
define i32 @handle_options(i8** nocapture readnone %0) {
ret i32 1
}
_execl(name, args) char *name;
int args;
{
  extern char **environ;
  _execve(name, &args, environ);
}


x86 assembly (clang, -O0):
<_execl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ebe(%rip),%rax
mov    (%rax),%rdx
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1030 <_execve@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_execl>:
push   %rax
mov    %esi,0x4(%rsp)
mov    0x2ecc(%rip),%rax
mov    (%rax),%rdx
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1030 <_execve@plt>
pop    %rcx
ret

LLVM IR (-O0):
@environ = external global i8**
define i32 @_execl(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = load i8**, i8*** @environ
%8 = call i32 (i8*, i32*, i8**, ...) bitcast (i32 (...)* @_execve to i32 (i8*, i32*, i8**, ...)*)(i8* %6, i32* %5, i8** %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
@environ = external global i8**
define i32 @_execl(i8* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = load i8**, i8*** @environ
%5 = call i32 (i8*, i32*, i8**, ...) bitcast (i32 (...)* @_execve to i32 (i8*, i32*, i8**, ...)*)(i8* %0, i32* %3, i8** %4)
ret i32 undef
}
double to_feet(double miles) { return (miles * 5280.0); }


x86 assembly (clang, -O0):
<to_feet>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_feet>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @to_feet(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 5.280000e+03
ret double %4
}

LLVM IR (-O2):
define double @to_feet(double %0) {
%2 = fmul double %0, 5.280000e+03
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  unsigned char c = 57;
  unsigned int i;
  printf("c: %u\n", c);
  printf("~c: %u\n", (unsigned char)~c);
  printf("~c: %u\n", (unsigned int)~c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x39,-0x5(%rbp)
movzbl -0x5(%rbp),%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x5(%rbp),%eax
xor    $0xffffffff,%eax
movzbl %al,%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
movzbl -0x5(%rbp),%esi
xor    $0xffffffff,%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee9(%rip),%rdi
mov    $0x39,%esi
call   1030 <printf@plt>
lea    0xed7(%rip),%rbx
mov    %rbx,%rdi
mov    $0xc6,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xffffffc6,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"c: %u\0A\00"
@.str.1 = [8 x i8] c"~c: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i8 57, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = xor i32 %8, -1
%10 = trunc i32 %9 to i8
%11 = zext i8 %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = xor i32 %14, -1
%16 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"c: %u\0A\00"
@.str.1 = [8 x i8] c"~c: %u\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 57)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 198)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 -58)
ret i32 0
}
/* Variables and functions */
int floor(double);
signed int ifloor(double x) { return floor(x); }


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

x86 assembly (clang, -O2):
<ifloor>:
jmp    1030 <floor@plt>

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

LLVM IR (-O2):
define i32 @ifloor(double %0) {
%2 = tail call i32 @floor(double %0)
ret i32 %2
}
void foo(short a, char b) { a = a * b; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movswl -0x2(%rbp),%eax
movsbl -0x3(%rbp),%ecx
imul   %ecx,%eax
mov    %ax,-0x2(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo(i16 signext %0, i8 signext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = mul nsw i32 %6, %8
%10 = trunc i32 %9 to i16
store i16 %10, i16* %3
ret void
}

LLVM IR (-O2):
define void @foo(i16 signext %0, i8 signext %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ digitalWrite(int, int);
void flipLight(int pin) {
  digitalWrite(pin, 1);
  delay(140);
  digitalWrite(pin, 0);
  delay(60);
}


x86 assembly (clang, -O0):
<flipLight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <digitalWrite@plt>
mov    $0x8c,%edi
call   1040 <delay@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <digitalWrite@plt>
mov    $0x3c,%edi
call   1040 <delay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flipLight>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%esi
call   1030 <digitalWrite@plt>
mov    $0x8c,%edi
call   1040 <delay@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <digitalWrite@plt>
mov    $0x3c,%edi
pop    %rbx
jmp    1040 <delay@plt>

LLVM IR (-O0):
define void @flipLight(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @digitalWrite(i32 %3, i32 1)
%5 = call i32 @delay(i32 140)
%6 = load i32, i32* %2
%7 = call i32 @digitalWrite(i32 %6, i32 0)
%8 = call i32 @delay(i32 60)
ret void
}

LLVM IR (-O2):
define void @flipLight(i32 %0) {
%2 = tail call i32 @digitalWrite(i32 %0, i32 1)
%3 = tail call i32 @delay(i32 140)
%4 = tail call i32 @digitalWrite(i32 %0, i32 0)
%5 = tail call i32 @delay(i32 60)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ list;

/* Variables and functions */
int /*<<< orphan*/ startCombi(int *, int);
int main(void) {
  int list[] = {1, 2, 3};
  int nSize = ((int)sizeof(list) / sizeof(int));
  startCombi(list, nSize);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x3,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <startCombi@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xeee(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xedb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1030 <startCombi@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.list = [3 x i32] [i32 1, i32 2, i32 3]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [3 x i32]* %2 to i8*
store i32 3, i32* %3
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @startCombi(i32* %5, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.list = [3 x i32] [i32 1, i32 2, i32 3]
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @startCombi(i32* %3, i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ written_amount(int, char *);
int main(int argc, char *argv[]) {
  char buffer[1000] = "";
  written_amount(16312, buffer);
  puts(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1040 <memset@plt>
lea    -0x400(%rbp),%rsi
mov    $0x3fb8,%edi
call   1050 <written_amount@plt>
lea    -0x400(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x3f0,%rsp
mov    %rsp,%rbx
mov    $0x3e8,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    $0x3fb8,%edi
mov    %rbx,%rsi
call   1050 <written_amount@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [1000 x i8]* %6 to i8*
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%9 = call i32 @written_amount(i32 16312, i8* %8)
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%11 = call i32 @puts(i8* %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = call i32 @written_amount(i32 16312, i8* %4)
%6 = call i32 @puts(i8* %4)
ret i32 0
}
unsigned int g(void) { return 5; }


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

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

LLVM IR (-O0):
define i32 @g() {
ret i32 5
}

LLVM IR (-O2):
define i32 @g() {
ret i32 5
}