xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, long, char *, unsigned char);
void native_byte_to_s(unsigned char recv, char *str, long buflen) {
  snprintf(str, buflen, "0x%02x", recv);
}


x86 assembly (clang, -O0):
<native_byte_to_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    0xecb(%rip),%rdx
movzbl -0x1(%rbp),%ecx
call   1030 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<native_byte_to_s>:
mov    %edi,%ecx
lea    0xee7(%rip),%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"0x%02x\00"
define void @native_byte_to_s(i8 zeroext %0, i8* %1, i64 %2) {
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i64
store i8 %0, i8* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = load i8, i8* %4
%10 = call i32 @snprintf(i8* %7, i64 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext %9)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"0x%02x\00"
define void @native_byte_to_s(i8 zeroext %0, i8* %1, i64 %2) {
%4 = tail call i32 @snprintf(i8* %1, i64 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Atm128GpioInterruptC__1__Interrupt__default__fired();
void Atm128GpioInterruptC__1__Interrupt__fired(void) {
  Atm128GpioInterruptC__1__Interrupt__default__fired();
}


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

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

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

LLVM IR (-O2):
define void @Atm128GpioInterruptC__1__Interrupt__fired() {
%1 = tail call i32 (...) @Atm128GpioInterruptC__1__Interrupt__default__fired()
ret void
}
void XtGetErrorDatabase() {}


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

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

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

LLVM IR (-O2):
define void @XtGetErrorDatabase() {
ret void
}
int compare_names(file1, file2)
char **file1, **file2;
{ return strcmp(*file1, *file2); }


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

x86 assembly (clang, -O2):
<compare_names>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @compare_names(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 = load i8*, i8** %5
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = call i32 @strcmp(i8* %6, i8* %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @compare_names(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(1) %4)
ret i32 %5
}
/* Variables and functions */
float cbrt_5f(float const);
float cbrta_halleyf(float const, float const);
float lab_f(const float x) {
  const float epsilon = 216.0f / 24389.0f;
  const float kappa = 24389.0f / 27.0f;
  if (x > epsilon) {
    const float a = cbrt_5f(x);
    return cbrta_halleyf(a, x);
  } else
    return (kappa * x + 16.0f) / 116.0f;
}


x86 assembly (clang, -O0):
<lab_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  0xecb(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xec2(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xeac(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1185 <lab_f+0x65>
movss  -0x8(%rbp),%xmm0
call   1030 <cbrt_5f@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <cbrta_halleyf@plt>
movss  %xmm0,-0x4(%rbp)
jmp    11b3 <lab_f+0x93>
movss  -0x8(%rbp),%xmm0
movss  0xe72(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe6e(%rip),%xmm1
addss  %xmm1,%xmm0
movss  0xe5e(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lab_f>:
push   %rax
ucomiss 0xed8(%rip),%xmm0
jbe    1141 <lab_f+0x21>
movss  %xmm0,0x4(%rsp)
call   1030 <cbrt_5f@plt>
movss  0x4(%rsp),%xmm1
pop    %rax
jmp    1040 <cbrta_halleyf@plt>
mulss  0xebb(%rip),%xmm0
addss  0xeb7(%rip),%xmm0
divss  0xeb3(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @lab_f(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %3
store float 0x3F822354E0000000, float* %4
store float 0x408C3A5EE0000000, float* %5
%7 = load float, float* %3
%8 = fcmp ogt float %7, 0x3F822354E0000000
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = load float, float* %3
%11 = call float @cbrt_5f(float %10)
store float %11, float* %6
%12 = load float, float* %6
%13 = load float, float* %3
%14 = call float @cbrta_halleyf(float %12, float %13)
store float %14, float* %2
br label %19
15: ; preds = %1
%16 = load float, float* %3
%17 = call float @llvm.fmuladd.f32(float 0x408C3A5EE0000000, float %16, float 1.600000e+01)
%18 = fdiv float %17, 1.160000e+02
store float %18, float* %2
br label %19
19: ; preds = %15, %9
%20 = load float, float* %2
ret float %20
}

LLVM IR (-O2):
define float @lab_f(float %0) {
%2 = fcmp ogt float %0, 0x3F822354E0000000
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call float @cbrt_5f(float %0)
%5 = tail call float @cbrta_halleyf(float %4, float %0)
br label %9
6: ; preds = %1
%7 = tail call float @llvm.fmuladd.f32(float %0, float 0x408C3A5EE0000000, float 1.600000e+01)
%8 = fdiv float %7, 1.160000e+02
br label %9
9: ; preds = %6, %3
%10 = phi float [ %5, %3 ], [ %8, %6 ]
ret float %10
}
/* Type definitions */
struct cpu {
  int dummy;
};

/* Variables and functions */
unsigned char cpu_get_r8(struct cpu *, int);
unsigned char cpu_get_b(struct cpu *cpu) { return cpu_get_r8(cpu, (3)); }


x86 assembly (clang, -O0):
<cpu_get_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1030 <cpu_get_r8@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_get_b>:
mov    $0x3,%esi
jmp    1030 <cpu_get_r8@plt>

LLVM IR (-O0):
%struct.cpu = type { i32 }
define zeroext i8 @cpu_get_b(%struct.cpu* %0) {
%2 = alloca %struct.cpu*
store %struct.cpu* %0, %struct.cpu** %2
%3 = load %struct.cpu*, %struct.cpu** %2
%4 = call zeroext i8 @cpu_get_r8(%struct.cpu* %3, i32 3)
ret i8 %4
}

LLVM IR (-O2):
%struct.cpu = type { i32 }
define zeroext i8 @cpu_get_b(%struct.cpu* %0) {
%2 = tail call zeroext i8 @cpu_get_r8(%struct.cpu* %0, i32 3)
ret i8 %2
}
unsigned long USBIntStatusEndpoint(unsigned long ulBase) {
  unsigned long ulStatus;
  ;
  ulStatus = (*((volatile unsigned short *)(ulBase + 0x00000002)));
  ulStatus |= ((*((volatile unsigned short *)(ulBase + 0x00000004))) << 16);
  return (ulStatus);
}


x86 assembly (clang, -O0):
<USBIntStatusEndpoint>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%ax
movzwl %ax,%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ax
movzwl %ax,%eax
shl    $0x10,%eax
cltq
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @USBIntStatusEndpoint(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = add i64 %4, 2
%6 = inttoptr i64 %5 to i16*
%7 = load volatile i16, i16* %6
%8 = zext i16 %7 to i64
store i64 %8, i64* %3
%9 = load i64, i64* %2
%10 = add i64 %9, 4
%11 = inttoptr i64 %10 to i16*
%12 = load volatile i16, i16* %11
%13 = zext i16 %12 to i32
%14 = shl i32 %13, 16
%15 = sext i32 %14 to i64
%16 = load i64, i64* %3
%17 = or i64 %16, %15
store i64 %17, i64* %3
%18 = load i64, i64* %3
ret i64 %18
}

LLVM IR (-O2):
define i64 @USBIntStatusEndpoint(i64 %0) {
%2 = add i64 %0, 2
%3 = inttoptr i64 %2 to i16*
%4 = load volatile i16, i16* %3
%5 = zext i16 %4 to i64
%6 = add i64 %0, 4
%7 = inttoptr i64 %6 to i16*
%8 = load volatile i16, i16* %7
%9 = zext i16 %8 to i32
%10 = shl nuw i32 %9, 16
%11 = sext i32 %10 to i64
%12 = or i64 %11, %5
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void PrintIndent(int Num) {
  int i;
  for (i = 0; i < Num; i++) {
    printf("    ");
  }
}


x86 assembly (clang, -O0):
<PrintIndent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1148 <PrintIndent+0x38>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <PrintIndent+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintIndent>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    113d <PrintIndent+0x2d>
mov    %edi,%ebx
lea    0xedf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffff,%ebx
jne    1130 <PrintIndent+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
define void @PrintIndent(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int ERR_isError(size_t);
unsigned ZBUFFv05_isError(size_t errorCode) { return ERR_isError(errorCode); }


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

x86 assembly (clang, -O2):
<ZBUFFv05_isError>:
jmp    1030 <ERR_isError@plt>

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

LLVM IR (-O2):
define i32 @ZBUFFv05_isError(i64 %0) {
%2 = tail call i32 @ERR_isError(i64 %0)
ret i32 %2
}
/* Variables and functions */
int count_bits(char *, int /*<<< orphan*/);
int count_0_bits(char *binary_string) { return count_bits(binary_string, '0'); }


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

x86 assembly (clang, -O2):
<count_0_bits>:
mov    $0x30,%esi
jmp    1030 <count_bits@plt>

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

LLVM IR (-O2):
define i32 @count_0_bits(i8* %0) {
%2 = tail call i32 @count_bits(i8* %0, i32 48)
ret i32 %2
}
/* Variables and functions */
#define GLUT_KEY_DOWN 129
#define GLUT_KEY_UP 128
int /*<<< orphan*/ down();
int /*<<< orphan*/ glutPostRedisplay();
int /*<<< orphan*/ up();
void special(int key, int x, int y) {
  switch (key) {
  case GLUT_KEY_UP:
    up();
    break;
  case GLUT_KEY_DOWN:
    down();
    break;
  default:
    return;
  }
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<special>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x80,%eax
je     116a <special+0x3a>
jmp    1157 <special+0x27>
mov    -0x10(%rbp),%eax
sub    $0x81,%eax
je     1176 <special+0x46>
jmp    1182 <special+0x52>
mov    $0x0,%al
call   1040 <up@plt>
jmp    1187 <special+0x57>
mov    $0x0,%al
call   1030 <down@plt>
jmp    1187 <special+0x57>
jmp    118e <special+0x5e>
mov    $0x0,%al
call   1050 <glutPostRedisplay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<special>:
push   %rax
cmp    $0x81,%edi
je     114a <special+0x1a>
cmp    $0x80,%edi
jne    1159 <special+0x29>
xor    %eax,%eax
call   1040 <up@plt>
jmp    1151 <special+0x21>
xor    %eax,%eax
call   1030 <down@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glutPostRedisplay@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @special(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
switch i32 %7, label %12 [
i32 128, label %8
i32 129, label %10
]
8: ; preds = %3
%9 = call i32 (...) @up()
br label %13
10: ; preds = %3
%11 = call i32 (...) @down()
br label %13
12: ; preds = %3
br label %15
13: ; preds = %10, %8
%14 = call i32 (...) @glutPostRedisplay()
br label %15
15: ; preds = %13, %12
ret void
}

LLVM IR (-O2):
define void @special(i32 %0, i32 %1, i32 %2) {
switch i32 %0, label %10 [
i32 128, label %4
i32 129, label %6
]
4: ; preds = %3
%5 = tail call i32 (...) @up()
br label %8
6: ; preds = %3
%7 = tail call i32 (...) @down()
br label %8
8: ; preds = %6, %4
%9 = tail call i32 (...) @glutPostRedisplay()
br label %10
10: ; preds = %3, %8
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
unsigned int _mm_extract_epi8(int /*<<< orphan*/, int);
unsigned int foo8(__m128i x) { return _mm_extract_epi8(x, 4); }


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

x86 assembly (clang, -O2):
<foo8>:
mov    $0x4,%esi
jmp    1030 <_mm_extract_epi8@plt>

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

LLVM IR (-O2):
define i32 @foo8(i32 %0) {
%2 = tail call i32 @_mm_extract_epi8(i32 %0, i32 4)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "Usage: whatsnew [-<width>] file file.cdif\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%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    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: whatsnew [-<width>] file file.cdif\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: whatsnew [-<width>] file file.cdif\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
void rop3_180_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~*D;
  stk2 = S & stk3;
  stk1 = T ^ stk2;
  *D = stk1;
}


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

x86 assembly (clang, -O2):
<rop3_180_0_0>:
mov    (%rdi),%al
not    %al
and    %sil,%al
xor    %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_180_0_0(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** %4
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = xor i32 %12, -1
%14 = trunc i32 %13 to i8
store i8 %14, i8* %9
%15 = load i8, i8* %5
%16 = zext i8 %15 to i32
%17 = load i8, i8* %9
%18 = zext i8 %17 to i32
%19 = and i32 %16, %18
%20 = trunc i32 %19 to i8
store i8 %20, i8* %8
%21 = load i8, i8* %6
%22 = zext i8 %21 to i32
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = xor i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %7
%27 = load i8, i8* %7
%28 = load i8*, i8** %4
store i8 %27, i8* %28
ret void
}

LLVM IR (-O2):
define void @rop3_180_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %4, -1
%6 = and i8 %5, %1
%7 = xor i8 %6, %2
store i8 %7, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_assert(int);
int main() {
  int i, sn = 0;
  for (i = 1; i <= 8; i++) {
    if (i < 4)
      sn = sn + (2);
  }
  __VERIFIER_assert(sn == 8 * (2) || sn == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jg     115d <main+0x4d>
cmpl   $0x4,-0x8(%rbp)
jge    114a <main+0x3a>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <main+0x3f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    $0x1,%al
cmpl   $0x10,-0xc(%rbp)
mov    %al,-0xd(%rbp)
je     1176 <main+0x66>
cmpl   $0x0,-0xc(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <__VERIFIER_assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 1, i32* %2
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 8
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 2
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %7
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 16
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 0
br label %23
23: ; preds = %20, %17
%24 = phi i1 [ true, %17 ], [ %22, %20 ]
%25 = zext i1 %24 to i32
%26 = call i32 @__VERIFIER_assert(i32 %25)
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @__VERIFIER_assert(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ s2chromapts(int, float *, float *, float *, float *, float,
                               float, float);
void s2chromapts_(int *n, float *ilong, float *lat, float *dist, float *size,
                  float *radius, float *dmin, float *dmax) {
  s2chromapts(*n, ilong, lat, dist, size, *radius, *dmin, *dmax);
}


x86 assembly (clang, -O0):
<s2chromapts_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm0
mov    0x10(%rbp),%rax
movss  (%rax),%xmm1
mov    0x18(%rbp),%rax
movss  (%rax),%xmm2
call   1030 <s2chromapts@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s2chromapts_>:
mov    0x10(%rsp),%r10
mov    0x8(%rsp),%rax
mov    (%rdi),%edi
movss  (%r9),%xmm0
movss  (%rax),%xmm1
movss  (%r10),%xmm2
jmp    1030 <s2chromapts@plt>

LLVM IR (-O0):
define void @s2chromapts_(i32* %0, float* %1, float* %2, float* %3, float* %4, float* %5, float* %6, float* %7) {
%9 = alloca i32*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float*
%14 = alloca float*
%15 = alloca float*
%16 = alloca float*
store i32* %0, i32** %9
store float* %1, float** %10
store float* %2, float** %11
store float* %3, float** %12
store float* %4, float** %13
store float* %5, float** %14
store float* %6, float** %15
store float* %7, float** %16
%17 = load i32*, i32** %9
%18 = load i32, i32* %17
%19 = load float*, float** %10
%20 = load float*, float** %11
%21 = load float*, float** %12
%22 = load float*, float** %13
%23 = load float*, float** %14
%24 = load float, float* %23
%25 = load float*, float** %15
%26 = load float, float* %25
%27 = load float*, float** %16
%28 = load float, float* %27
%29 = call i32 @s2chromapts(i32 %18, float* %19, float* %20, float* %21, float* %22, float %24, float %26, float %28)
ret void
}

LLVM IR (-O2):
define void @s2chromapts_(i32* nocapture %0, float* %1, float* %2, float* %3, float* %4, float* nocapture %5, float* nocapture %6, float* nocapture %7) {
%9 = load i32, i32* %0
%10 = load float, float* %5
%11 = load float, float* %6
%12 = load float, float* %7
%13 = tail call i32 @s2chromapts(i32 %9, float* %1, float* %2, float* %3, float* %4, float %10, float %11, float %12)
ret void
}
int sqr(int n) { return n * n; }


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

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

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

LLVM IR (-O2):
define i32 @sqr(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
/* Variables and functions */
short read_ZIGBEE_short(int);
int /*<<< orphan*/ write_ZIGBEE_short(int, int);
void nonbeacon_PAN_coordinator_device() {
  short int temp = 0;
  temp = read_ZIGBEE_short(0x00);
  temp = temp | 0x08;
  write_ZIGBEE_short(0x00, temp);
  temp = read_ZIGBEE_short(0x11);
  temp = temp & 0xDF;
  write_ZIGBEE_short(0x11, temp);
  write_ZIGBEE_short(0x10, 0xFF);
}


x86 assembly (clang, -O0):
<nonbeacon_PAN_coordinator_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x0,-0x2(%rbp)
xor    %edi,%edi
call   1030 <read_ZIGBEE_short@plt>
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
or     $0x8,%eax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%esi
xor    %edi,%edi
call   1040 <write_ZIGBEE_short@plt>
mov    $0x11,%edi
call   1030 <read_ZIGBEE_short@plt>
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
and    $0xdf,%eax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%esi
mov    $0x11,%edi
call   1040 <write_ZIGBEE_short@plt>
mov    $0x10,%edi
mov    $0xff,%esi
call   1040 <write_ZIGBEE_short@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nonbeacon_PAN_coordinator_device>:
push   %rax
xor    %edi,%edi
call   1030 <read_ZIGBEE_short@plt>
or     $0x8,%eax
movswl %ax,%esi
xor    %edi,%edi
call   1040 <write_ZIGBEE_short@plt>
mov    $0x11,%edi
call   1030 <read_ZIGBEE_short@plt>
and    $0xdf,%eax
mov    $0x11,%edi
mov    %eax,%esi
call   1040 <write_ZIGBEE_short@plt>
mov    $0x10,%edi
mov    $0xff,%esi
pop    %rax
jmp    1040 <write_ZIGBEE_short@plt>

LLVM IR (-O0):
define void @nonbeacon_PAN_coordinator_device() {
%1 = alloca i16
store i16 0, i16* %1
%2 = call signext i16 @read_ZIGBEE_short(i32 0)
store i16 %2, i16* %1
%3 = load i16, i16* %1
%4 = sext i16 %3 to i32
%5 = or i32 %4, 8
%6 = trunc i32 %5 to i16
store i16 %6, i16* %1
%7 = load i16, i16* %1
%8 = sext i16 %7 to i32
%9 = call i32 @write_ZIGBEE_short(i32 0, i32 %8)
%10 = call signext i16 @read_ZIGBEE_short(i32 17)
store i16 %10, i16* %1
%11 = load i16, i16* %1
%12 = sext i16 %11 to i32
%13 = and i32 %12, 223
%14 = trunc i32 %13 to i16
store i16 %14, i16* %1
%15 = load i16, i16* %1
%16 = sext i16 %15 to i32
%17 = call i32 @write_ZIGBEE_short(i32 17, i32 %16)
%18 = call i32 @write_ZIGBEE_short(i32 16, i32 255)
ret void
}

LLVM IR (-O2):
define void @nonbeacon_PAN_coordinator_device() {
%1 = tail call signext i16 @read_ZIGBEE_short(i32 0)
%2 = or i16 %1, 8
%3 = sext i16 %2 to i32
%4 = tail call i32 @write_ZIGBEE_short(i32 0, i32 %3)
%5 = tail call signext i16 @read_ZIGBEE_short(i32 17)
%6 = and i16 %5, 223
%7 = zext i16 %6 to i32
%8 = tail call i32 @write_ZIGBEE_short(i32 17, i32 %7)
%9 = tail call i32 @write_ZIGBEE_short(i32 16, i32 255)
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int scmp(void *a, void *b) { return strcmp((char *)a, (char *)b); }


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

x86 assembly (clang, -O2):
<scmp>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @scmp(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 = load i8*, i8** %4
%7 = call i32 @strcmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @scmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
void Simplest_Example_Mov_Constant_To_Variable(void) {
  printf("\n--- %s() ---\n", __func__);
  int x = 0x3366;
  __asm__("movl $0x1F, %0" : "=r"(x));
  printf("x = 0x%X\n", x);
}


x86 assembly (clang, -O0):
<Simplest_Example_Mov_Constant_To_Variable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xee9(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x3366,-0x4(%rbp)
mov    $0x1f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Simplest_Example_Mov_Constant_To_Variable>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xef0(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1f,%esi
lea    0xf07(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"\0A--- %s() ---\0A\00"
@__func__.Simplest_Example_Mov_Constant_To_Variable = [42 x i8] c"Simplest_Example_Mov_Constant_To_Variable\00"
@.str.1 = [10 x i8] c"x = 0x%X\0A\00"
define void @Simplest_Example_Mov_Constant_To_Variable() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @__func__.Simplest_Example_Mov_Constant_To_Variable, i64 0, i64 0))
store i32 13158, i32* %1
%3 = call i32 asm "movl $$0x1F, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"\0A--- %s() ---\0A\00"
@__func__.Simplest_Example_Mov_Constant_To_Variable = [42 x i8] c"Simplest_Example_Mov_Constant_To_Variable\00"
@.str.1 = [10 x i8] c"x = 0x%X\0A\00"
define void @Simplest_Example_Mov_Constant_To_Variable() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @__func__.Simplest_Example_Mov_Constant_To_Variable, i64 0, i64 0))
%2 = tail call i32 asm "movl $$0x1F, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %2)
ret void
}
void glutWindowStatusFunc(void (*func)(int state)) {}


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

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

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

LLVM IR (-O2):
define void @glutWindowStatusFunc(void (i32)* nocapture %0) {
ret void
}
/* Variables and functions */
long double __infer_nondet_long_double();
long double tgammal(long double x) { return __infer_nondet_long_double(); }


x86 assembly (clang, -O0):
<tgammal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
xor    %eax,%eax
call   1030 <__infer_nondet_long_double@plt>
fld    %st(0)
fstp   %st(0)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define x86_fp80 @tgammal(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = call x86_fp80 (...) @__infer_nondet_long_double()
ret x86_fp80 %3
}

LLVM IR (-O2):
define x86_fp80 @tgammal(x86_fp80 %0) {
%2 = tail call x86_fp80 (...) @__infer_nondet_long_double()
ret x86_fp80 %2
}
/* Variables and functions */
int chown(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ getgid();
int /*<<< orphan*/ getuid();
int bad_chown(void *addr) { return chown((char *)addr, getuid(), getgid()); }


x86 assembly (clang, -O0):
<bad_chown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getgid@plt>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    %eax,%edx
call   1050 <chown@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bad_chown>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <getuid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getgid@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <chown@plt>

LLVM IR (-O0):
define i32 @bad_chown(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (...) @getuid()
%5 = call i32 (...) @getgid()
%6 = call i32 @chown(i8* %3, i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @bad_chown(i8* nocapture %0) {
%2 = tail call i32 (...) @getuid()
%3 = tail call i32 (...) @getgid()
%4 = tail call i32 @chown(i8* %0, i32 %2, i32 %3)
ret i32 %4
}
/* Variables and functions */
int bf_g(char **, int /*<<< orphan*/);
int bg(char **args) { return (bf_g(args, 0)); }


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

x86 assembly (clang, -O2):
<bg>:
xor    %esi,%esi
jmp    1030 <bf_g@plt>

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

LLVM IR (-O2):
define i32 @bg(i8** %0) {
%2 = tail call i32 @bf_g(i8** %0, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
void log_exit() { closelog(); }


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

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

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

LLVM IR (-O2):
define void @log_exit() {
%1 = tail call i32 (...) @closelog()
ret void
}
/* Type definitions */
struct stat {
  int dummy;
};
struct FTW {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ remove(char const *);
int remove_file(const char *path, const struct stat *sbuf, int type,
                struct FTW *ftwb) {
  (void)sbuf;
  (void)type;
  (void)ftwb;
  remove(path);
  return 0;
}


x86 assembly (clang, -O0):
<remove_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <remove@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_file>:
push   %rax
call   1030 <remove@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.FTW = type { i32 }
define i32 @remove_file(i8* nocapture %0, %struct.stat* nocapture readnone %1, i32 %2, %struct.FTW* nocapture readnone %3) {
%5 = tail call i32 @remove(i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
void help(char *argv0) {
  fprintf(stderr,
          "DAN64 6502 Assembler & Disassembler\n"
          "Copyright (C) 2015 Juan J. Martinez <jjm@usebox.net>\n\n"
          "Usage: %s [-h] [-a address] [-o output] input\n\n"
          "   input        input filename\n"
          "   -d           disassemble (default: assemble)\n"
          "   -s           short format (disassembler only)\n"
          "   -a address   load address (default: %i)\n"
          "   -h           this help screen\n"
          "   -v           print version an exit\n"
          "   -o output    output filename (default: stdout)\n\n",
          argv0, 0x1a00);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
mov    $0x1a00,%ecx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
mov    $0x1a00,%ecx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [431 x i8] c"DAN64 6502 Assembler & Disassembler\0ACopyright (C) 2015 Juan J. Martinez <jjm@usebox.net>\0A\0AUsage: %s [-h] [-a address] [-o output] input\0A\0A input input filename\0A -d disassemble (default: assemble)\0A -s short format (disassembler only)\0A -a address load address (default: %i)\0A -h this help screen\0A -v print version an exit\0A -o output output filename (default: stdout)\0A\0A\00"
define void @help(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 ([431 x i8], [431 x i8]* @.str, i64 0, i64 0), i8* %4, i32 6656)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [431 x i8] c"DAN64 6502 Assembler & Disassembler\0ACopyright (C) 2015 Juan J. Martinez <jjm@usebox.net>\0A\0AUsage: %s [-h] [-a address] [-o output] input\0A\0A input input filename\0A -d disassemble (default: assemble)\0A -s short format (disassembler only)\0A -a address load address (default: %i)\0A -h this help screen\0A -v print version an exit\0A -o output output filename (default: stdout)\0A\0A\00"
define void @help(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([431 x i8], [431 x i8]* @.str, i64 0, i64 0), i8* %0, i32 6656)
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t htole16(uint16_t in) { return (in << 8) | (in >> 8); }


x86 assembly (clang, -O0):
<htole16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<htole16>:
mov    %edi,%eax
shl    $0x8,%eax
sar    $0x8,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @htole16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = load i32, i32* %2
%6 = ashr i32 %5, 8
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @htole16(i32 %0) {
%2 = shl i32 %0, 8
%3 = ashr i32 %0, 8
%4 = or i32 %2, %3
ret i32 %4
}
long smax(int num_bits) {
  int i;
  long smax = 1l;
  for (i = 0; i < num_bits - 1; i++) {
    smax = smax * 2l;
  }
  return smax - 1l;
}


x86 assembly (clang, -O0):
<smax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1141 <smax+0x41>
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1116 <smax+0x16>
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<smax>:
cmp    $0x2,%edi
jl     111c <smax+0x1c>
lea    -0x1(%rdi),%edx
add    $0xfffffffe,%edi
mov    %edx,%ecx
and    $0x7,%ecx
cmp    $0x7,%edi
jae    111f <smax+0x1f>
mov    $0x1,%eax
jmp    1139 <smax+0x39>
xor    %eax,%eax
ret
and    $0xfffffff8,%edx
mov    $0x1,%eax
nopw   0x0(%rax,%rax,1)
shl    $0x8,%rax
add    $0xfffffff8,%edx
jne    1130 <smax+0x30>
test   %ecx,%ecx
je     1148 <smax+0x48>
nopl   (%rax)
add    %rax,%rax
add    $0xffffffff,%ecx
jne    1140 <smax+0x40>
add    $0xffffffffffffffff,%rax
ret

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

LLVM IR (-O2):
define i64 @smax(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %29
4: ; preds = %1
%5 = add i32 %0, -2
%6 = and i32 %2, 7
%7 = icmp ult i32 %5, 7
br i1 %7, label %16, label %8
8: ; preds = %4
%9 = and i32 %2, -8
br label %10
10: ; preds = %10, %8
%11 = phi i64 [ 1, %8 ], [ %13, %10 ]
%12 = phi i32 [ 0, %8 ], [ %14, %10 ]
%13 = shl i64 %11, 8
%14 = add i32 %12, 8
%15 = icmp eq i32 %14, %9
br i1 %15, label %16, label %10
16: ; preds = %10, %4
%17 = phi i64 [ undef, %4 ], [ %13, %10 ]
%18 = phi i64 [ 1, %4 ], [ %13, %10 ]
%19 = icmp eq i32 %6, 0
br i1 %19, label %26, label %20
20: ; preds = %16, %20
%21 = phi i64 [ %23, %20 ], [ %18, %16 ]
%22 = phi i32 [ %24, %20 ], [ 0, %16 ]
%23 = shl nsw i64 %21, 1
%24 = add i32 %22, 1
%25 = icmp eq i32 %24, %6
br i1 %25, label %26, label %20
26: ; preds = %20, %16
%27 = phi i64 [ %17, %16 ], [ %23, %20 ]
%28 = add i64 %27, -1
br label %29
29: ; preds = %26, %1
%30 = phi i64 [ 0, %1 ], [ %28, %26 ]
ret i64 %30
}
/* Variables and functions */
int abs(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int number;
  int result;
  printf("Enter a integer number : \n");
  scanf("%d", &number);
  result = abs(number);
  printf("Absolute value of %d is %d\n", number, result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %esi,%edx
neg    %edx
cmovs  %esi,%edx
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Enter a integer number : \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"Absolute value of %d is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @abs(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"Absolute value of %d is %d\0A\00"
@str = [26 x i8] c"Enter a integer number : \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @llvm.abs.i32(i32 %5, i1 true)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void set_8(uint8_t *p, uint8_t v) { *p = v; }


x86 assembly (clang, -O0):
<set_8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_8>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @set_8(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ value;

/* Variables and functions */
int CHAR_BIT;
unsigned extract_continuous_bits(unsigned long value, int start, int end) {
  unsigned mask = (~0u) >> (CHAR_BIT * sizeof(value) - end - 1);
  return (value & mask) >> start;
}


x86 assembly (clang, -O0):
<extract_continuous_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2ecb(%rip),%rax
movslq (%rax),%rax
shl    $0x3,%rax
movslq -0x10(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,%ecx
mov    $0xffffffff,%eax
shr    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
and    %rcx,%rax
mov    -0xc(%rbp),%ecx
shr    %cl,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_continuous_bits>:
mov    %rdi,%rax
mov    0x2ed6(%rip),%rcx
mov    (%rcx),%ecx
not    %edx
lea    (%rdx,%rcx,8),%ecx
shl    %cl,%eax
shr    %cl,%eax
mov    %esi,%ecx
shr    %cl,%rax
ret

LLVM IR (-O0):
@CHAR_BIT = global i32 0
define i32 @extract_continuous_bits(i64 %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* @CHAR_BIT
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 8
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = sub i64 %10, %12
%14 = sub i64 %13, 1
%15 = trunc i64 %14 to i32
%16 = lshr i32 -1, %15
store i32 %16, i32* %7
%17 = load i64, i64* %4
%18 = load i32, i32* %7
%19 = zext i32 %18 to i64
%20 = and i64 %17, %19
%21 = load i32, i32* %5
%22 = zext i32 %21 to i64
%23 = lshr i64 %20, %22
%24 = trunc i64 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define i32 @extract_continuous_bits(i64 %0, i32 %1, i32 %2) {
%4 = load i32, i32* @CHAR_BIT
%5 = shl i32 %4, 3
%6 = xor i32 %2, -1
%7 = add i32 %5, %6
%8 = lshr i32 -1, %7
%9 = zext i32 %8 to i64
%10 = and i64 %9, %0
%11 = zext i32 %1 to i64
%12 = lshr i64 %10, %11
%13 = trunc i64 %12 to i32
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
int main(void) { f(4); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @f(i32 4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 4)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ int8_t;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_store_si128(int /*<<< orphan*/ *, int /*<<< orphan*/);
extern __attribute__((__gnu___, __always___, __artificial__)) int
_MM_EXTRACT_EPI8(__m128i vec, const int LANE) {
  __attribute__((aligned(16))) int8_t tmp[16];
  _mm_store_si128((__m128i *)tmp, vec);
  return (int)tmp[LANE];
}


x86 assembly (clang, -O0):
<_MM_EXTRACT_EPI8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <_mm_store_si128@plt>
movslq -0x8(%rbp),%rax
mov    -0x90(%rbp,%rax,8),%rax
ff
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_MM_EXTRACT_EPI8>:
push   %rbx
sub    $0x80,%rsp
mov    %esi,%ebx
mov    %edi,%esi
mov    %rsp,%rdi
call   1030 <_mm_store_si128@plt>
movslq %ebx,%rax
mov    (%rsp,%rax,8),%eax
add    $0x80,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @_MM_EXTRACT_EPI8(i32 %0, i32 %1) {
%3 = alloca [16 x i64]
%4 = bitcast [16 x i64]* %3 to i8*
%5 = bitcast [16 x i64]* %3 to i32*
%6 = call i32 @_mm_store_si128(i32* %5, i32 %0)
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds [16 x i64], [16 x i64]* %3, i64 0, i64 %7
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
ret i32 %10
}