xunge/DecIR huggingface dataset:
int function_1(int a, int b) { return (2 * a + 3 * b + 4 * a * b - a * b * 5); }


x86 assembly (clang, -O0):
<function_1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
imul   $0x3,-0x8(%rbp),%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x8(%rbp),%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
imul   $0x5,%ecx,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_1>:
mov    $0x3,%eax
sub    %edi,%eax
imul   %esi,%eax
lea    (%rax,%rdi,2),%eax
ret

LLVM IR (-O0):
define i32 @function_1(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 = mul nsw i32 2, %5
%7 = load i32, i32* %4
%8 = mul nsw i32 3, %7
%9 = add nsw i32 %6, %8
%10 = load i32, i32* %3
%11 = mul nsw i32 4, %10
%12 = load i32, i32* %4
%13 = mul nsw i32 %11, %12
%14 = add nsw i32 %9, %13
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = mul nsw i32 %15, %16
%18 = mul nsw i32 %17, 5
%19 = sub nsw i32 %14, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @function_1(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 1
%4 = sub i32 3, %0
%5 = mul i32 %4, %1
%6 = add i32 %5, %3
ret i32 %6
}
/* Variables and functions */
unsigned char gfmultby02(unsigned char);
unsigned char gfmultby0d(unsigned char b) {
  return (unsigned char)((int)gfmultby02(gfmultby02(gfmultby02(b))) ^
                         (int)gfmultby02(gfmultby02(b)) ^ (int)(b));
}


x86 assembly (clang, -O0):
<gfmultby0d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <gfmultby02@plt>
movzbl %al,%edi
call   1030 <gfmultby02@plt>
movzbl %al,%edi
call   1030 <gfmultby02@plt>
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <gfmultby02@plt>
movzbl %al,%edi
call   1030 <gfmultby02@plt>
mov    %al,%cl
mov    -0x8(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
movzbl -0x1(%rbp),%ecx
xor    %ecx,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfmultby0d>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <gfmultby02@plt>
movzbl %al,%edi
call   1030 <gfmultby02@plt>
movzbl %al,%edi
call   1030 <gfmultby02@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <gfmultby02@plt>
movzbl %al,%edi
call   1030 <gfmultby02@plt>
xor    %bl,%al
xor    %bpl,%al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @gfmultby0d(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call zeroext i8 @gfmultby02(i8 zeroext %3)
%5 = call zeroext i8 @gfmultby02(i8 zeroext %4)
%6 = call zeroext i8 @gfmultby02(i8 zeroext %5)
%7 = zext i8 %6 to i32
%8 = load i8, i8* %2
%9 = call zeroext i8 @gfmultby02(i8 zeroext %8)
%10 = call zeroext i8 @gfmultby02(i8 zeroext %9)
%11 = zext i8 %10 to i32
%12 = xor i32 %7, %11
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = xor i32 %12, %14
%16 = trunc i32 %15 to i8
ret i8 %16
}

LLVM IR (-O2):
define zeroext i8 @gfmultby0d(i8 zeroext %0) {
%2 = tail call zeroext i8 @gfmultby02(i8 zeroext %0)
%3 = tail call zeroext i8 @gfmultby02(i8 zeroext %2)
%4 = tail call zeroext i8 @gfmultby02(i8 zeroext %3)
%5 = tail call zeroext i8 @gfmultby02(i8 zeroext %0)
%6 = tail call zeroext i8 @gfmultby02(i8 zeroext %5)
%7 = xor i8 %4, %0
%8 = xor i8 %7, %6
ret i8 %8
}
/* Variables and functions */
int whisperPutc(int);
int putchar(int c) { return whisperPutc(c); }


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

x86 assembly (clang, -O2):
<putchar>:
jmp    1030 <whisperPutc@plt>

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

LLVM IR (-O2):
define i32 @putchar(i32 %0) {
%2 = tail call i32 @whisperPutc(i32 %0)
ret i32 %2
}
/* Variables and functions */
int printUsage(char *);
int runProgram(int, char **);
int main(int argc, char **argv) {
  return (argc != 3) ? printUsage(argv[0]) : runProgram(argc, argv);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1154 <main+0x34>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <printUsage@plt>
mov    %eax,-0x14(%rbp)
jmp    1163 <main+0x43>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <runProgram@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x3,%edi
jne    112f <main+0xf>
mov    $0x3,%edi
jmp    1030 <runProgram@plt>
mov    (%rsi),%rdi
jmp    1040 <printUsage@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printUsage(i8* %5)
br label %9
7: ; preds = %2
%8 = tail call i32 @runProgram(i32 3, i8** %1)
br label %9
9: ; preds = %7, %4
%10 = phi i32 [ %6, %4 ], [ %8, %7 ]
ret i32 %10
}
/* Variables and functions */
long time(int /*<<< orphan*/ *);
signed long int meat_time_get_stamp_now(void) {
  return (signed long int)(time(NULL) / 60l);
}


x86 assembly (clang, -O0):
<meat_time_get_stamp_now>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <time@plt>
mov    $0x3c,%ecx
cqto
idiv   %rcx
pop    %rbp
ret

x86 assembly (clang, -O2):
<meat_time_get_stamp_now>:
push   %rax
xor    %edi,%edi
call   1030 <time@plt>
mov    %rax,%rcx
movabs $0x8888888888888889,%rdx
88 88 88
imul   %rdx
add    %rdx,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x5,%rcx
add    %rax,%rcx
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @meat_time_get_stamp_now() {
%1 = call i64 @time(i32* null)
%2 = sdiv i64 %1, 60
ret i64 %2
}

LLVM IR (-O2):
define i64 @meat_time_get_stamp_now() {
%1 = tail call i64 @time(i32* null)
%2 = sdiv i64 %1, 60
ret i64 %2
}
/* Variables and functions */
scalar_t__ test_mgmt_printing();
int main(void) {
  int error_counter = 0;
  error_counter += test_mgmt_printing();
  return error_counter ? -1 : 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <test_mgmt_printing@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @test_mgmt_printing()
%2 = trunc i64 %1 to i32
%3 = icmp ne i32 %2, 0
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
void *jhc_malloc_basic(size_t);
void *__attribute__((malloc)) jhc_malloc_atomic(size_t n) {
  do {
  } while (0);
  return jhc_malloc_basic(n);
}


x86 assembly (clang, -O0):
<jhc_malloc_atomic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
jmp    1121 <jhc_malloc_atomic+0x11>
mov    -0x8(%rbp),%rdi
call   1030 <jhc_malloc_basic@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jhc_malloc_atomic>:
jmp    1030 <jhc_malloc_basic@plt>

LLVM IR (-O0):
define noalias i8* @jhc_malloc_atomic(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
br label %3
3: ; preds = %1
br label %4
4: ; preds = %3
%5 = load i64, i64* %2
%6 = call i8* @jhc_malloc_basic(i64 %5)
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @jhc_malloc_atomic(i64 %0) {
%2 = tail call i8* @jhc_malloc_basic(i64 %0)
ret i8* %2
}
int test_imm_58int8_reg(signed char val) {
  return ((val) & (-0x58 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_58int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffa8,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_58int8_reg>:
test   $0xa8,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_58int8_reg(i8 signext %0) {
%2 = and i8 %0, -88
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void clrscr(void) { system("clear"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
define void @clrscr() {
%1 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @clrscr() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ ReadUint16Le(void const *, int /*<<< orphan*/ *);
int32_t ReadInt16Le(const void *in, int16_t *value) {
  return ReadUint16Le(in, (uint16_t *)value);
}


x86 assembly (clang, -O0):
<ReadInt16Le>:
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 <ReadUint16Le@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadInt16Le>:
jmp    1030 <ReadUint16Le@plt>

LLVM IR (-O0):
define i32 @ReadInt16Le(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = load i32*, i32** %4
%7 = call i32 @ReadUint16Le(i8* %5, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @ReadInt16Le(i8* %0, i32* %1) {
%3 = tail call i32 @ReadUint16Le(i8* %0, i32* %1)
ret i32 %3
}
unsigned xrop3_159_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;
  stk1 = T & stk2;
  stk1 = ~stk1;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_159_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    -0x10(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @xrop3_159_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* %7
%26 = load i32, i32* %9
%27 = and i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = xor i32 %28, -1
store i32 %29, i32* %8
%30 = load i32, i32* %8
ret i32 %30
}

LLVM IR (-O2):
define i32 @xrop3_159_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, 255
%8 = and i32 %6, %7
%9 = xor i32 %8, -1
ret i32 %9
}
int main(void) {
  static int i = 100;
  return 0;
}


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):
@main.i = internal global i32 100
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 */
scalar_t__ FLT_EPSILON;
scalar_t__ fabs(double const);
bool is_not_zero(const double a) { return fabs(a) > FLT_EPSILON; }


x86 assembly (clang, -O0):
<is_not_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
mov    0x2eb2(%rip),%rcx
cmp    (%rcx),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_not_zero>:
push   %rax
call   1030 <fabs@plt>
mov    0x2ec3(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%rax
setg   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@FLT_EPSILON = global i64 0
define i32 @is_not_zero(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @fabs(double %3)
%5 = load i64, i64* @FLT_EPSILON
%6 = icmp sgt i64 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
@FLT_EPSILON = global i64 0
define i32 @is_not_zero(double %0) {
%2 = tail call i64 @fabs(double %0)
%3 = load i64, i64* @FLT_EPSILON
%4 = icmp sgt i64 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ set_sign_flag(int);
void handle_sign_flag(const int value) {
  set_sign_flag((value & 0b10000000) > 0);
}


x86 assembly (clang, -O0):
<handle_sign_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <set_sign_flag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_sign_flag>:
shr    $0x7,%edi
and    $0x1,%edi
jmp    1030 <set_sign_flag@plt>

LLVM IR (-O0):
define void @handle_sign_flag(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 128
%5 = icmp sgt i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @set_sign_flag(i32 %6)
ret void
}

LLVM IR (-O2):
define void @handle_sign_flag(i32 %0) {
%2 = lshr i32 %0, 7
%3 = and i32 %2, 1
%4 = tail call i32 @set_sign_flag(i32 %3)
ret void
}
void free_matrix(int **matrix, int N) {
  for (int i = 0; i < N; ++i)
    free(matrix[i]);
  free(matrix);
}


x86 assembly (clang, -O0):
<free_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_matrix+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_matrix+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_matrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_matrix+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_matrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_matrix(i32** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = bitcast i32** %0 to i8*
tail call void @free(i8* %7)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds i32*, i32** %0, i64 %9
%11 = bitcast i32** %10 to i8**
%12 = load i8*, i8** %11
tail call void @free(i8* %12)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %8
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int main() {
  if (malloc(1)) {
    printf("foo\n");
  } else {
    printf("bar\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1040 <malloc@plt>
cmp    $0x0,%rax
je     1154 <main+0x34>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
jmp    1160 <main+0x40>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <malloc@plt>
test   %rax,%rax
lea    0xecb(%rip),%rax
lea    0xec8(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [4 x i8] c"bar\00"
@str.2 = [4 x i8] c"foo\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 1)
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.2, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret i32 0
}
/* Type definitions */
struct nouveau_stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct nouveau_stat *);
void nouveau_stat_destroy(struct nouveau_stat *ns) { free(ns); }


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

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

LLVM IR (-O2):
%struct.nouveau_stat = type { i32 }
define void @nouveau_stat_destroy(%struct.nouveau_stat* nocapture %0) {
%2 = tail call i32 @free(%struct.nouveau_stat* %0)
ret void
}
int sfun_rtwmakecfg_module_02(int i) { return i + 2; }


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

x86 assembly (clang, -O2):
<sfun_rtwmakecfg_module_02>:
lea    0x2(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @sfun_rtwmakecfg_module_02(i32 %0) {
%2 = add nsw i32 %0, 2
ret i32 %2
}
void back_key_up(void) {}


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

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

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

LLVM IR (-O2):
define void @back_key_up() {
ret void
}
void dropbox_queue_event_binaryfile(char *name, char *path) {}


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

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

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

LLVM IR (-O2):
define void @dropbox_queue_event_binaryfile(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int main() {
  unsigned int a;
  ((unsigned char *)&a)[0] = 0x12;
  ((unsigned char *)&a)[1] = 0x34;
  ((unsigned char *)&a)[2] = 0x56;
  ((unsigned char *)&a)[3] = 0x78;
  if (a != 0x78563412) {
    _exit(-1);
  }
  _exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x12,-0x8(%rbp)
movb   $0x34,-0x7(%rbp)
movb   $0x56,-0x6(%rbp)
movb   $0x78,-0x5(%rbp)
cmpl   $0x78563412,-0x8(%rbp)
je     1146 <main+0x36>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = bitcast i32* %2 to i8*
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 18, i8* %4
%5 = bitcast i32* %2 to i8*
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8 52, i8* %6
%7 = bitcast i32* %2 to i8*
%8 = getelementptr inbounds i8, i8* %7, i64 2
store i8 86, i8* %8
%9 = bitcast i32* %2 to i8*
%10 = getelementptr inbounds i8, i8* %9, i64 3
store i8 120, i8* %10
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 2018915346
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @_exit(i32 -1)
unreachable
15: ; preds = %0
%16 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @_exit(i32 0)
unreachable
}
long os_atomic_dec_long(volatile long *val) {
  return __sync_sub_and_fetch(val, 1);
}


x86 assembly (clang, -O0):
<os_atomic_dec_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0xffffffffffffffff,%rax
lock xadd %rax,(%rcx)
sub    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_atomic_dec_long>:
mov    $0xffffffffffffffff,%rax
lock xadd %rax,(%rdi)
add    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @os_atomic_dec_long(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = atomicrmw sub i64* %3, i64 1 seq_cst
%5 = sub i64 %4, 1
ret i64 %5
}

LLVM IR (-O2):
define i64 @os_atomic_dec_long(i64* nocapture %0) {
%2 = atomicrmw sub i64* %0, i64 1 seq_cst
%3 = add i64 %2, -1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printPath(int path[], int length) {
  int i;
  for (i = 0; i < length; i++) {
    printf("=> %d ", path[i]);
  }
  printf("\n");
  return;
}


x86 assembly (clang, -O0):
<printPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printPath+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printPath+0x16>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPath>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <printPath+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <printPath+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"=> %d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @printPath(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"=> %d \00"
define void @printPath(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int str_prefix(char *str, char *prefix) {
  int str_len;
  int prefix_len;
  str_len = strlen(str);
  prefix_len = strlen(prefix);
  if (str_len < prefix_len)
    return 0;
  if (!strncmp(str, prefix, prefix_len))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<str_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1160 <str_prefix+0x40>
movl   $0x0,-0x4(%rbp)
jmp    118c <str_prefix+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1185 <str_prefix+0x65>
movl   $0x1,-0x4(%rbp)
jmp    118c <str_prefix+0x6c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_prefix>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ebp
jl     1155 <str_prefix+0x35>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strncmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @str_prefix(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp slt i32 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 @strncmp(i8* %0, i8* %1, i32 %4)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t btom_d(const uint32_t in) {
  return (in & 0xFF000000 >> 24) + (in & 0x00FF0000 >> 8) +
         (in & 0x0000FF00 << 8) + (in & 0x000000FF << 24);
}


x86 assembly (clang, -O0):
<btom_d>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff000000,%ecx
add    %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @btom_d(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = load i32, i32* %2
%6 = and i32 %5, 65280
%7 = add i32 %4, %6
%8 = load i32, i32* %2
%9 = and i32 %8, 16711680
%10 = add i32 %7, %9
%11 = load i32, i32* %2
%12 = and i32 %11, -16777216
%13 = add i32 %10, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @btom_d(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ DISPLAY(char *, char const *);
void UNIMPLEMENTED(const char *pszMsg) { DISPLAY("UNIMPLEMENTED", pszMsg); }


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

x86 assembly (clang, -O2):
<UNIMPLEMENTED>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <DISPLAY@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"UNIMPLEMENTED\00"
define void @UNIMPLEMENTED(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @DISPLAY(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"UNIMPLEMENTED\00"
define void @UNIMPLEMENTED(i8* %0) {
%2 = tail call i32 @DISPLAY(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int sfd_islower(const char c) { return (c >= 'a' && c <= 'z'); }


x86 assembly (clang, -O0):
<sfd_islower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x61,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <sfd_islower+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sfd_islower>:
add    $0x9f,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

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

LLVM IR (-O2):
define i32 @sfd_islower(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
scalar_t__ clock();
void start_timer(clock_t *t) {
  clock_t now = clock();
  while (now == clock())
    ;
  *t = clock();
}


x86 assembly (clang, -O0):
<start_timer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
jne    114b <start_timer+0x3b>
jmp    1127 <start_timer+0x17>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_timer>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <clock@plt>
cmp    %rax,%rbx
je     1130 <start_timer+0x20>
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @start_timer(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
%4 = call i64 (...) @clock()
store i64 %4, i64* %3
br label %5
5: ; preds = %9, %1
%6 = load i64, i64* %3
%7 = call i64 (...) @clock()
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = call i64 (...) @clock()
%12 = load i64*, i64** %2
store i64 %11, i64* %12
ret void
}

LLVM IR (-O2):
define void @start_timer(i64* nocapture writeonly %0) {
%2 = tail call i64 (...) @clock()
br label %3
3: ; preds = %3, %1
%4 = tail call i64 (...) @clock()
%5 = icmp eq i64 %2, %4
br i1 %5, label %3, label %6
6: ; preds = %3
%7 = tail call i64 (...) @clock()
store i64 %7, i64* %0
ret void
}
/* Variables and functions */
int foo(int);
int main() {
  int *pi;
  pi = NULL;
  int c = foo(*pi);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <foo@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <foo@plt>
mov    $0x1,%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* null, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = call i32 @foo(i32 %5)
store i32 %6, i32* %3
ret i32 1
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 undef)
ret i32 1
}
int seradSmeny(const void *a, const void *b) {
  const int *aR = (const int *)a;
  const int *bR = (const int *)b;
  if (aR[1] == bR[1])
    return aR[0] - bR[0];
  return bR[1] - aR[1];
}


x86 assembly (clang, -O0):
<seradSmeny>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    0x4(%rcx),%eax
jne    1144 <seradSmeny+0x44>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1155 <seradSmeny+0x55>
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0x20(%rbp),%rcx
sub    0x4(%rcx),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<seradSmeny>:
mov    0x4(%rsi),%eax
sub    0x4(%rdi),%eax
jne    110c <seradSmeny+0xc>
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @seradSmeny(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %6
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %7
%12 = load i32*, i32** %6
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = load i32*, i32** %7
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %16
%18 = icmp eq i32 %14, %17
br i1 %18, label %19, label %27
19: ; preds = %2
%20 = load i32*, i32** %6
%21 = getelementptr inbounds i32, i32* %20, i64 0
%22 = load i32, i32* %21
%23 = load i32*, i32** %7
%24 = getelementptr inbounds i32, i32* %23, i64 0
%25 = load i32, i32* %24
%26 = sub nsw i32 %22, %25
store i32 %26, i32* %3
br label %35
27: ; preds = %2
%28 = load i32*, i32** %7
%29 = getelementptr inbounds i32, i32* %28, i64 1
%30 = load i32, i32* %29
%31 = load i32*, i32** %6
%32 = getelementptr inbounds i32, i32* %31, i64 1
%33 = load i32, i32* %32
%34 = sub nsw i32 %30, %33
store i32 %34, i32* %3
br label %35
35: ; preds = %27, %19
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @seradSmeny(i8* nocapture %0, i8* nocapture %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 4
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = getelementptr inbounds i8, i8* %1, i64 4
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, %5
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = bitcast i8* %1 to i32*
%12 = bitcast i8* %0 to i32*
%13 = load i32, i32* %12
%14 = load i32, i32* %11
%15 = sub nsw i32 %13, %14
br label %18
16: ; preds = %2
%17 = sub nsw i32 %8, %5
br label %18
18: ; preds = %16, %10
%19 = phi i32 [ %15, %10 ], [ %17, %16 ]
ret i32 %19
}
put4hex(w) int w;
{
  put2hex(w >> 8);
  put2hex(w);
}


x86 assembly (clang, -O0):
<put4hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
sar    $0x8,%edi
mov    $0x0,%al
call   1030 <put2hex@plt>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <put2hex@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put4hex>:
push   %rbx
mov    %edi,%ebx
sar    $0x8,%edi
xor    %eax,%eax
call   1030 <put2hex@plt>
mov    %ebx,%edi
xor    %eax,%eax
pop    %rbx
jmp    1030 <put2hex@plt>

LLVM IR (-O0):
define i32 @put4hex(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = ashr i32 %4, 8
%6 = call i32 (i32, ...) bitcast (i32 (...)* @put2hex to i32 (i32, ...)*)(i32 %5)
%7 = load i32, i32* %3
%8 = call i32 (i32, ...) bitcast (i32 (...)* @put2hex to i32 (i32, ...)*)(i32 %7)
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @put4hex(i32 %0) {
%2 = ashr i32 %0, 8
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @put2hex to i32 (i32, ...)*)(i32 %2)
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @put2hex to i32 (i32, ...)*)(i32 %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ stdout;
int write(int /*<<< orphan*/, char *, int);
int term_bold() { return write(stdout, "\x1b[1m", 4) != 4; }


x86 assembly (clang, -O0):
<term_bold>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cmp    $0x4,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<term_bold>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
xor    %ecx,%ecx
cmp    $0x4,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [5 x i8] c"\1B[1m\00"
define i32 @term_bold() {
%1 = load i32, i32* @stdout
%2 = call i32 @write(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp ne i32 %2, 4
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [5 x i8] c"\1B[1m\00"
define i32 @term_bold() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @write(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp ne i32 %2, 4
%4 = zext i1 %3 to i32
ret i32 %4
}
void swap_le16(void *src, void *dest) {
  unsigned char *s = src;
  unsigned char *d = dest;
  d[0] = s[1];
  d[1] = s[0];
}


x86 assembly (clang, -O0):
<swap_le16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_le16>:
mov    0x1(%rdi),%al
mov    %al,(%rsi)
mov    (%rdi),%al
mov    %al,0x1(%rsi)
ret

LLVM IR (-O0):
define void @swap_le16(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = load i8*, i8** %6
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 %11, i8* %13
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8 %16, i8* %18
ret void
}

LLVM IR (-O2):
define void @swap_le16(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
store i8 %4, i8* %1
%5 = load i8, i8* %0
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %5, i8* %6
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ res_path;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ write_matrix(int *, char *, int);
void write_result(int **res, int matrix_size) {
  char res_path[32];
  snprintf(res_path, sizeof(res_path), "matrixmul_compare_%06d.dat",
           matrix_size);
  write_matrix(*res, res_path, matrix_size);
}


x86 assembly (clang, -O0):
<write_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0x20,%esi
lea    0xebe(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <write_matrix@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_result>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xecb(%rip),%rdx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x20,%esi
mov    %ebx,%ecx
call   1040 <snprintf@plt>
mov    (%r14),%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <write_matrix@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"matrixmul_compare_%06d.dat\00"
define void @write_result(i32** %0, i32 %1) {
%3 = alloca i32**
%4 = alloca i32
%5 = alloca [32 x i8]
store i32** %0, i32*** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %4
%8 = call i32 @snprintf(i8* %6, i32 32, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32**, i32*** %3
%10 = load i32*, i32** %9
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%12 = load i32, i32* %4
%13 = call i32 @write_matrix(i32* %10, i8* %11, i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"matrixmul_compare_%06d.dat\00"
define void @write_result(i32** nocapture %0, i32 %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 32, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %1)
%6 = load i32*, i32** %0
%7 = call i32 @write_matrix(i32* %6, i8* %4, i32 %1)
ret void
}
int foo(int *restrict p, int i) {
  int *restrict q;
  int *restrict r;
  int v, w;
  q = p + 1;
  r = q - i;
  v = *r;
  *p = 1;
  w = *r;
  return v + w;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    -0x28(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movslq %esi,%rcx
shl    $0x2,%rcx
mov    %rdi,%rax
sub    %rcx,%rax
neg    %rcx
mov    0x4(%rax),%eax
movl   $0x1,(%rdi)
add    0x4(%rdi,%rcx,1),%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32* noalias nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = sext i32 %1 to i64
%5 = sub nsw i64 0, %4
%6 = getelementptr inbounds i32, i32* %3, i64 %5
%7 = load i32, i32* %6
store i32 1, i32* %0
%8 = load i32, i32* %6
%9 = add nsw i32 %8, %7
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128d;

/* Variables and functions */
int /*<<< orphan*/ _mm_storer_pd(double *, int /*<<< orphan*/);
void test_mm_storer_pd(__m128d A, double *B) { _mm_storer_pd(B, A); }


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

x86 assembly (clang, -O2):
<test_mm_storer_pd>:
mov    %edi,%eax
mov    %rsi,%rdi
mov    %eax,%esi
jmp    1030 <_mm_storer_pd@plt>

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

LLVM IR (-O2):
define void @test_mm_storer_pd(i32 %0, double* %1) {
%3 = tail call i32 @_mm_storer_pd(double* %1, i32 %0)
ret void
}
void do_some_stuff() {}


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

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

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

LLVM IR (-O2):
define void @do_some_stuff() {
ret void
}
long __attribute__((warn_unused_result)) PTR_ERR(const void *ptr) {
  return (long)ptr;
}


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

x86 assembly (clang, -O2):
<PTR_ERR>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @PTR_ERR(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @PTR_ERR(i8* %0) {
%2 = ptrtoint i8* %0 to i64
ret i64 %2
}