xunge/DecIR huggingface dataset:
/* Variables and functions */
int waitforack(int);
int write(int, char *, int);
int sendfin(int sock) {
  int bsent;
  bsent = write(sock, "FIN", sizeof("FIN"));
  if (bsent < sizeof("FIN"))
    return (-1);
  return waitforack(sock);
}


x86 assembly (clang, -O0):
<sendfin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xecb(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0x4,%rax
jae    115c <sendfin+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1167 <sendfin+0x47>
mov    -0x8(%rbp),%edi
call   1040 <waitforack@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendfin>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cmp    $0x4,%eax
jae    1140 <sendfin+0x20>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    %ebx,%edi
pop    %rbx
jmp    1040 <waitforack@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"FIN\00"
define i32 @sendfin(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @write(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = icmp ult i64 %8, 4
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %14
11: ; preds = %1
%12 = load i32, i32* %3
%13 = call i32 @waitforack(i32 %12)
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [4 x i8] c"FIN\00"
define i32 @sendfin(i32 %0) {
%2 = tail call i32 @write(i32 %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp ult i32 %2, 4
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @waitforack(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ -1, %1 ]
ret i32 %7
}
void foo1d() {}


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

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

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

LLVM IR (-O2):
define void @foo1d() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ crypto_auth_hmacsha512256(unsigned char *,
                                             unsigned char const *,
                                             unsigned long long,
                                             unsigned char const *);
int crypto_verify_32(unsigned char const *, unsigned char *);
int crypto_auth_hmacsha512256_verify(const unsigned char *h,
                                     const unsigned char *in,
                                     unsigned long long inlen,
                                     const unsigned char *k) {
  unsigned char correct[32];
  crypto_auth_hmacsha512256(correct, in, inlen, k);
  return crypto_verify_32(h, correct);
}


x86 assembly (clang, -O0):
<crypto_auth_hmacsha512256_verify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <crypto_auth_hmacsha512256@plt>
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1040 <crypto_verify_32@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_auth_hmacsha512256_verify>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <crypto_auth_hmacsha512256@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <crypto_verify_32@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @crypto_auth_hmacsha512256_verify(i8* %0, i8* %1, i64 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca [32 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i8* %3, i8** %8
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %6
%12 = load i64, i64* %7
%13 = load i8*, i8** %8
%14 = call i32 @crypto_auth_hmacsha512256(i8* %10, i8* %11, i64 %12, i8* %13)
%15 = load i8*, i8** %5
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%17 = call i32 @crypto_verify_32(i8* %15, i8* %16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @crypto_auth_hmacsha512256_verify(i8* %0, i8* %1, i64 %2, i8* %3) {
%5 = alloca [32 x i8]
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%7 = call i32 @crypto_auth_hmacsha512256(i8* %6, i8* %1, i64 %2, i8* %3)
%8 = call i32 @crypto_verify_32(i8* %0, i8* %6)
ret i32 %8
}
int SWFSound_getSampleRate(int flags) {
  switch (flags & 0x0c) {
  case (3 << 2):
    return 44100;
  case (2 << 2):
    return 22050;
  case (1 << 2):
    return 11025;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<SWFSound_getSampleRate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xc,%eax
mov    %eax,-0xc(%rbp)
sub    $0x4,%eax
je     1158 <SWFSound_getSampleRate+0x58>
jmp    111e <SWFSound_getSampleRate+0x1e>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     114c <SWFSound_getSampleRate+0x4c>
jmp    112f <SWFSound_getSampleRate+0x2f>
mov    -0xc(%rbp),%eax
sub    $0xc,%eax
jne    1164 <SWFSound_getSampleRate+0x64>
jmp    1140 <SWFSound_getSampleRate+0x40>
movl   $0xac44,-0x4(%rbp)
jmp    116b <SWFSound_getSampleRate+0x6b>
movl   $0x5622,-0x4(%rbp)
jmp    116b <SWFSound_getSampleRate+0x6b>
movl   $0x2b11,-0x4(%rbp)
jmp    116b <SWFSound_getSampleRate+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SWFSound_getSampleRate>:
and    $0xc,%edi
cmp    $0x4,%edi
je     1118 <SWFSound_getSampleRate+0x18>
cmp    $0xc,%edi
je     111e <SWFSound_getSampleRate+0x1e>
cmp    $0x8,%edi
jne    1124 <SWFSound_getSampleRate+0x24>
mov    $0x5622,%eax
ret
mov    $0x2b11,%eax
ret
mov    $0xac44,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @SWFSound_getSampleRate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 12
switch i32 %5, label %9 [
i32 12, label %6
i32 8, label %7
i32 4, label %8
]
6: ; preds = %1
store i32 44100, i32* %2
br label %10
7: ; preds = %1
store i32 22050, i32* %2
br label %10
8: ; preds = %1
store i32 11025, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %8, %7, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @SWFSound_getSampleRate(i32 %0) {
%2 = and i32 %0, 12
switch i32 %2, label %5 [
i32 12, label %6
i32 8, label %3
i32 4, label %4
]
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3
%7 = phi i32 [ 0, %5 ], [ 11025, %4 ], [ 22050, %3 ], [ 44100, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void print_version() {
  printf("NodeFinderC Version: %s\n", "1.1.7");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xee7(%rip),%rsi
call   1030 <printf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_version>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xeea(%rip),%rsi
call   1030 <printf@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"NodeFinderC Version: %s\0A\00"
@.str.1 = [6 x i8] c"1.1.7\00"
@EXIT_SUCCESS = global i32 0
define void @print_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@.str = [25 x i8] c"NodeFinderC Version: %s\0A\00"
@.str.1 = [6 x i8] c"1.1.7\00"
@EXIT_SUCCESS = global i32 0
define void @print_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ cstore(int, scalar_t__);
scalar_t__ ifetch();
void iinc() { cstore(4, ifetch() + 1); }


x86 assembly (clang, -O0):
<iinc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <ifetch@plt>
mov    %rax,%rsi
add    $0x1,%rsi
mov    $0x4,%edi
call   1030 <cstore@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<iinc>:
push   %rax
xor    %eax,%eax
call   1040 <ifetch@plt>
lea    0x1(%rax),%rsi
mov    $0x4,%edi
pop    %rax
jmp    1030 <cstore@plt>

LLVM IR (-O0):
define void @iinc() {
%1 = call i64 (...) @ifetch()
%2 = add nsw i64 %1, 1
%3 = call i32 @cstore(i32 4, i64 %2)
ret void
}

LLVM IR (-O2):
define void @iinc() {
%1 = tail call i64 (...) @ifetch()
%2 = add nsw i64 %1, 1
%3 = tail call i32 @cstore(i32 4, i64 %2)
ret void
}
/* Type definitions */
struct stat {
  int st_size;
};
typedef int off_t;

/* Variables and functions */
scalar_t__ fstat(int, struct stat *);
off_t Filesize(int fd) {
  struct stat stats;
  int ret = -1;
  if (fstat(fd, &stats) == 0) {
    ret = stats.st_size;
  }
  return ret;
}


x86 assembly (clang, -O0):
<Filesize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1030 <fstat@plt>
cmp    $0x0,%rax
jne    113e <Filesize+0x2e>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Filesize>:
push   %rax
mov    %rsp,%rsi
call   1030 <fstat@plt>
neg    %rax
sbb    %eax,%eax
or     (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @Filesize(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.stat
%4 = alloca i32
store i32 %0, i32* %2
store i32 -1, i32* %4
%5 = load i32, i32* %2
%6 = call i64 @fstat(i32 %5, %struct.stat* %3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %4
br label %11
11: ; preds = %8, %1
%12 = load i32, i32* %4
ret i32 %12
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @Filesize(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 %7, i32 -1
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ _fail(char const *const, int const);
int /*<<< orphan*/ values_equal_display_error(void *, void *);
void _assert_int_equal(const int a, const int b, const char *const file,
                       const int line) {
  if (!values_equal_display_error((void *)a, (void *)b)) {
    _fail(file, line);
  }
}


x86 assembly (clang, -O0):
<_assert_int_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movslq -0x4(%rbp),%rdi
movslq -0x8(%rbp),%rsi
call   1030 <values_equal_display_error@plt>
cmp    $0x0,%eax
jne    1157 <_assert_int_equal+0x37>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <_fail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_assert_int_equal>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%rbx
movslq %edi,%rdi
movslq %esi,%rsi
call   1030 <values_equal_display_error@plt>
test   %eax,%eax
je     113e <_assert_int_equal+0x1e>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <_fail@plt>

LLVM IR (-O0):
define void @_assert_int_equal(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i8*
%15 = call i32 @values_equal_display_error(i8* %11, i8* %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %4
%18 = load i8*, i8** %7
%19 = load i32, i32* %8
%20 = call i32 @_fail(i8* %18, i32 %19)
br label %21
21: ; preds = %17, %4
ret void
}

LLVM IR (-O2):
define void @_assert_int_equal(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = sext i32 %0 to i64
%6 = inttoptr i64 %5 to i8*
%7 = sext i32 %1 to i64
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @values_equal_display_error(i8* %6, i8* %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = tail call i32 @_fail(i8* %2, i32 %3)
br label %13
13: ; preds = %11, %4
ret void
}
int is_extended(int type) { return (type == 5 || type == 0xf || type == 0x85); }


x86 assembly (clang, -O0):
<is_extended>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x5,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1132 <is_extended+0x32>
mov    $0x1,%al
cmpl   $0xf,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1132 <is_extended+0x32>
cmpl   $0x85,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_extended>:
mov    $0x1,%eax
cmp    $0x5,%edi
je     110f <is_extended+0xf>
cmp    $0xf,%edi
jne    1110 <is_extended+0x10>
ret
xor    %eax,%eax
cmp    $0x85,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_extended(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 5
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 15
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 133
br label %11
11: ; preds = %8, %5, %1
%12 = phi i1 [ true, %5 ], [ true, %1 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @is_extended(i32 %0) {
switch i32 %0, label %2 [
i32 15, label %5
i32 5, label %5
]
2: ; preds = %1
%3 = icmp eq i32 %0, 133
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
long lclamp(long min, long n, long max) {
  return (min < n) ? (n < max ? n : max) : min;
}


x86 assembly (clang, -O0):
<lclamp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    114e <lclamp+0x4e>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1139 <lclamp+0x39>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1141 <lclamp+0x41>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1156 <lclamp+0x56>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lclamp>:
mov    %rdx,%rax
cmp    %rdx,%rsi
cmovl  %rsi,%rax
cmp    %rsi,%rdi
cmovge %rdi,%rax
ret

LLVM IR (-O0):
define i64 @lclamp(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = icmp slt i64 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %3
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = icmp slt i64 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i64, i64* %5
br label %18
16: ; preds = %10
%17 = load i64, i64* %6
br label %18
18: ; preds = %16, %14
%19 = phi i64 [ %15, %14 ], [ %17, %16 ]
br label %22
20: ; preds = %3
%21 = load i64, i64* %4
br label %22
22: ; preds = %20, %18
%23 = phi i64 [ %19, %18 ], [ %21, %20 ]
ret i64 %23
}

LLVM IR (-O2):
define i64 @lclamp(i64 %0, i64 %1, i64 %2) {
%4 = icmp slt i64 %0, %1
%5 = icmp slt i64 %1, %2
%6 = select i1 %5, i64 %1, i64 %2
%7 = select i1 %4, i64 %6, i64 %0
ret i64 %7
}
/* Variables and functions */
scalar_t__ coinToss(double);
void subsetSelect(double p, int seqlength, int *selected) {
  int i;
  for (i = 0; i < seqlength; i++)
    selected[i] = coinToss(p) ? 1 : 0;
  return;
}


x86 assembly (clang, -O0):
<subsetSelect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116b <subsetSelect+0x5b>
movsd  -0x8(%rbp),%xmm0
call   1030 <coinToss@plt>
mov    %rax,%rcx
xor    %edx,%edx
mov    $0x1,%eax
cmp    $0x0,%rcx
cmovne %eax,%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <subsetSelect+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subsetSelect>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %edi,%edi
jle    1150 <subsetSelect+0x40>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
movsd  %xmm0,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
movsd  0x8(%rsp),%xmm0
call   1030 <coinToss@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <subsetSelect+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @subsetSelect(double %0, i32 %1, i32* nocapture writeonly %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %13, %7 ]
%9 = tail call i64 @coinToss(double %0)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
%12 = getelementptr inbounds i32, i32* %2, i64 %8
store i32 %11, i32* %12
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %15, label %7
15: ; preds = %7, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _printk(char *);
int /*<<< orphan*/ abort();
halt() {
  _printk("\n...Halt!\n");
  abort();
}


x86 assembly (clang, -O0):
<halt>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <_printk@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<halt>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <_printk@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"\0A...Halt!\0A\00"
define i32 @halt() {
%1 = call i32 @_printk(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [11 x i8] c"\0A...Halt!\0A\00"
define i32 @halt() {
%1 = tail call i32 @_printk(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @abort()
unreachable
}
void XCheckTypedEvent() {}


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

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

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

LLVM IR (-O2):
define void @XCheckTypedEvent() {
ret void
}
int utl_ret(int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @utl_ret(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int strcmp(char *, char *);
int charCompare(const void *leftKey, const void *rightKey) {
  return strcmp((char *)leftKey, (char *)rightKey);
}


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

LLVM IR (-O0):
define i32 @charCompare(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 @charCompare(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
int test_imm_7Eint32_mem(int *val) {
  return ((*val) & (0x7E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_7Eint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 126
%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_7Eint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 126
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int dap_read_word(int);
int /*<<< orphan*/ dap_write_word(int, int);
int /*<<< orphan*/ sleep_ms(int);
void target_erase(void) {
  dap_write_word(0x41002100, 0x00001f00);
  dap_write_word(0x41002100, 0x00000010);
  sleep_ms(100);
  while (0 == (dap_read_word(0x41002100) & 0x00000100))
    ;
}


x86 assembly (clang, -O0):
<target_erase>:
push   %rbp
mov    %rsp,%rbp
mov    $0x41002100,%edi
mov    $0x1f00,%esi
call   1030 <dap_write_word@plt>
mov    $0x41002100,%edi
mov    $0x10,%esi
call   1030 <dap_write_word@plt>
mov    $0x64,%edi
call   1040 <sleep_ms@plt>
mov    $0x41002100,%edi
call   1050 <dap_read_word@plt>
mov    %eax,%ecx
and    $0x100,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    117d <target_erase+0x4d>
jmp    115c <target_erase+0x2c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<target_erase>:
push   %rax
mov    $0x41002100,%edi
mov    $0x1f00,%esi
call   1030 <dap_write_word@plt>
mov    $0x41002100,%edi
mov    $0x10,%esi
call   1030 <dap_write_word@plt>
mov    $0x64,%edi
call   1040 <sleep_ms@plt>
nopl   0x0(%rax)
mov    $0x41002100,%edi
call   1050 <dap_read_word@plt>
test   $0x100,%eax
je     1160 <target_erase+0x30>
pop    %rax
ret

LLVM IR (-O0):
define void @target_erase() {
%1 = call i32 @dap_write_word(i32 1090527488, i32 7936)
%2 = call i32 @dap_write_word(i32 1090527488, i32 16)
%3 = call i32 @sleep_ms(i32 100)
br label %4
4: ; preds = %8, %0
%5 = call i32 @dap_read_word(i32 1090527488)
%6 = and i32 %5, 256
%7 = icmp eq i32 0, %6
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @target_erase() {
%1 = tail call i32 @dap_write_word(i32 1090527488, i32 7936)
%2 = tail call i32 @dap_write_word(i32 1090527488, i32 16)
%3 = tail call i32 @sleep_ms(i32 100)
br label %4
4: ; preds = %4, %0
%5 = tail call i32 @dap_read_word(i32 1090527488)
%6 = and i32 %5, 256
%7 = icmp eq i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
ret void
}
/* Variables and functions */
int _tfswrite(int, char *, int);
int /*<<< orphan*/ monLock();
int /*<<< orphan*/ monUnlock();
int mon_tfswrite(int fd, char *buf, int cnt) {
  int ret;
  monLock();
  ret = _tfswrite(fd, buf, cnt);
  monUnlock();
  return (ret);
}


x86 assembly (clang, -O0):
<mon_tfswrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1030 <monLock@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <_tfswrite@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <monUnlock@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mon_tfswrite>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <monLock@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <_tfswrite@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <monUnlock@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mon_tfswrite(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = call i32 (...) @monLock()
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @_tfswrite(i32 %9, i8* %10, i32 %11)
store i32 %12, i32* %7
%13 = call i32 (...) @monUnlock()
%14 = load i32, i32* %7
ret i32 %14
}

LLVM IR (-O2):
define i32 @mon_tfswrite(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 (...) @monLock()
%5 = tail call i32 @_tfswrite(i32 %0, i8* %1, i32 %2)
%6 = tail call i32 (...) @monUnlock()
ret i32 %5
}
/* Variables and functions */
int _discard();
int _usage();
int main(int argc, char *argv[]) {
  if (argc != 1)
    return _usage();
  return _discard();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     114f <main+0x2f>
mov    $0x0,%al
call   1030 <_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    1159 <main+0x39>
mov    $0x0,%al
call   1040 <_discard@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
cmp    $0x1,%edi
jne    112c <main+0xc>
jmp    1040 <_discard@plt>
jmp    1030 <_usage@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, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @_usage()
store i32 %9, i32* %3
br label %12
10: ; preds = %2
%11 = call i32 (...) @_discard()
store i32 %11, i32* %3
br label %12
12: ; preds = %10, %8
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @_usage()
br label %8
6: ; preds = %2
%7 = tail call i32 (...) @_discard()
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ %7, %6 ]
ret i32 %9
}
void rop3_21_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = T & S;
  stk1 = *D | stk2;
  stk1 = ~stk1;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_21_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)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_21_0_0>:
and    %edx,%esi
or     (%rdi),%sil
not    %sil
mov    %sil,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_21_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = and i8 %2, %1
%5 = load i8, i8* %0
%6 = or i8 %5, %4
%7 = xor i8 %6, -1
store i8 %7, i8* %0
ret void
}
adrreg0regx1(r0, r1, x0, x1, p0, p1) unsigned int r0, r1;
unsigned int *p0, *p1;
{
  if ((p0[10000000]) <= (p1[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adrreg0regx1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2625a00(%rax),%eax
mov    -0x28(%rbp),%rcx
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
ja     113f <adrreg0regx1+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    1146 <adrreg0regx1+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0regx1>:
mov    0x2625a00(%r8),%edx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    (%r9,%rcx,4),%edx
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @adrreg0regx1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32* nocapture %5) {
%7 = getelementptr inbounds i32, i32* %4, i64 10000000
%8 = load i32, i32* %7
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i32, i32* %5, i64 %9
%11 = load i32, i32* %10
%12 = icmp ule i32 %8, %11
%13 = zext i1 %12 to i32
ret i32 %13
}
int f_ble_mm2(float *a1, float *a2) {
  return !(__builtin_islessequal(*a1, *a2));
}


x86 assembly (clang, -O0):
<f_ble_mm2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
ucomiss %xmm1,%xmm0
setae  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_ble_mm2>:
movss  (%rsi),%xmm0
xor    %eax,%eax
ucomiss (%rdi),%xmm0
setb   %al
ret

LLVM IR (-O0):
define i32 @f_ble_mm2(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = load float*, float** %4
%8 = load float, float* %7
%9 = fcmp ole float %6, %8
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @f_ble_mm2(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fcmp ugt float %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
void ssc_log_release(void) { closelog(); }


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

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

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

LLVM IR (-O2):
define void @ssc_log_release() {
%1 = tail call i32 (...) @closelog()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 1;
  int b = 2;
  int c = 3;
  printf("%d\n", a);
  printf("%d\n", b);
  printf("%d\n", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
ret i32 0
}
void isr_3_Interrupt(void) {}


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

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

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

LLVM IR (-O2):
define void @isr_3_Interrupt() {
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int compare_strings(const void *a, const void *b) {
  const char **aa = (const char **)a;
  const char **bb = (const char **)b;
  return strcmp(*aa, *bb);
}


x86 assembly (clang, -O0):
<compare_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
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    (%rax),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @compare_strings(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
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %12, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @compare_strings(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ quicksort(int *, int /*<<< orphan*/, int);
void qsort(int *arr, int len) { quicksort(arr, 0, len - 1); }


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

x86 assembly (clang, -O2):
<qsort>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <quicksort@plt>

LLVM IR (-O0):
define void @qsort(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %6, 1
%8 = call i32 @quicksort(i32* %5, i32 0, i32 %7)
ret void
}

LLVM IR (-O2):
define void @qsort(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @quicksort(i32* %0, i32 0, i32 %3)
ret void
}
int test_imm_F9uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0xF9 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_F9uint64_highword_reg>:
movabs $0xf900000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_F9uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 1069446856704
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int IS_ERR(const void *ptr) {
  return (((unsigned long)ptr) >= (unsigned long)-4095);
}


x86 assembly (clang, -O0):
<IS_ERR>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmp    $0xfffffffffffff001,%rax
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IS_ERR>:
xor    %eax,%eax
cmp    $0xfffffffffffff001,%rdi
setae  %al
ret

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

LLVM IR (-O2):
define i32 @IS_ERR(i8* readnone %0) {
%2 = icmp ugt i8* %0, inttoptr (i64 -4096 to i8*)
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ BNCIO(int);
long int BNCTrigger() {
  long int stat = 99;
  BNCIO(14);
  return (stat);
}


x86 assembly (clang, -O0):
<BNCTrigger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x63,-0x8(%rbp)
mov    $0xe,%edi
call   1030 <BNCIO@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BNCTrigger>:
push   %rax
mov    $0xe,%edi
call   1030 <BNCIO@plt>
mov    $0x63,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @BNCTrigger() {
%1 = alloca i64
store i64 99, i64* %1
%2 = call i32 @BNCIO(i32 14)
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @BNCTrigger() {
%1 = tail call i32 @BNCIO(i32 14)
ret i64 99
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t decode_prescalar(uint8_t m) {
  switch (m) {
  case 0:
    return 1;
  case 1:
    return 2;
  case 2:
    return 4;
  case 3:
    return 8;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<decode_prescalar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     115c <decode_prescalar+0x5c>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    1163 <decode_prescalar+0x63>
movl   $0x2,-0x4(%rbp)
jmp    1163 <decode_prescalar+0x63>
movl   $0x4,-0x4(%rbp)
jmp    1163 <decode_prescalar+0x63>
movl   $0x8,-0x4(%rbp)
jmp    1163 <decode_prescalar+0x63>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_prescalar>:
mov    $0xffffffff,%eax
cmp    $0x3,%edi
ja     1117 <decode_prescalar+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @decode_prescalar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
]
5: ; preds = %1
store i32 1, i32* %2
br label %10
6: ; preds = %1
store i32 2, i32* %2
br label %10
7: ; preds = %1
store i32 4, i32* %2
br label %10
8: ; preds = %1
store i32 8, i32* %2
br label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@switch.table.decode_prescalar = [4 x i32] [i32 1, i32 2, i32 4, i32 8]
define i32 @decode_prescalar(i32 %0) {
%2 = icmp ult i32 %0, 4
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.decode_prescalar, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ -1, %1 ]
ret i32 %8
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long root;
};
typedef TYPE_1__ XKeyEvent;

/* Variables and functions */
void set_XKeyEvent_root(void *_p, unsigned long _v) {
  ((XKeyEvent *)_p)->root = (unsigned long)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XKeyEvent_root(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XKeyEvent_root(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
AR0IR1(r0, r1, x0, x1, p0, p1) unsigned char r0, r1;
unsigned char *p0, *p1;
{
  if ((p0[10000000]) <= (*p1))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<AR0IR1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movzbl 0x989680(%rax),%eax
mov    -0x20(%rbp),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
jg     1144 <AR0IR1+0x44>
movl   $0x1,-0x4(%rbp)
jmp    114b <AR0IR1+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AR0IR1>:
mov    0x989680(%r8),%cl
xor    %eax,%eax
cmp    (%r9),%cl
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @AR0IR1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture %4, i8* nocapture %5) {
%7 = getelementptr inbounds i8, i8* %4, i64 10000000
%8 = load i8, i8* %7
%9 = load i8, i8* %5
%10 = icmp ule i8 %8, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int, char const *,
                          char const *);
void conv1(const char *srt_name, int i, const char *ssd_name) {
  printf("zwsrt.exe"
         " %s %d %s.ssd %s.zwdsp\n",
         srt_name, i, ssd_name, ssd_name);
}


x86 assembly (clang, -O0):
<conv1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conv1>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee1(%rip),%rdi
mov    %rcx,%r8
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"zwsrt.exe %s %d %s.ssd %s.zwdsp\0A\00"
define void @conv1(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i8* %9, i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"zwsrt.exe %s %d %s.ssd %s.zwdsp\0A\00"
define void @conv1(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2, i8* %2)
ret void
}
void f() {
  int a;
  a<0 || 1> 2 || a<3 || 4>(5) || 6 < 7 || 8 > 9 || 10 < 11 || 12 > 13;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1150 <f+0x50>
mov    $0x1,%al
cmpl   $0x3,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1150 <f+0x50>
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x5(%rbp)
jne    1150 <f+0x50>
jmp    1134 <f+0x34>
mov    $0x1,%al
test   $0x1,%al
mov    %al,-0x5(%rbp)
jne    1150 <f+0x50>
jmp    1146 <f+0x46>
xor    %eax,%eax
mov    %al,-0x5(%rbp)
jmp    1150 <f+0x50>
mov    -0x5(%rbp),%al
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = icmp slt i32 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 3
br i1 %6, label %10, label %7
7: ; preds = %4
br i1 true, label %10, label %8
8: ; preds = %7
br i1 true, label %10, label %9
9: ; preds = %8
br label %10
10: ; preds = %9, %8, %7, %4, %0
%11 = phi i1 [ true, %8 ], [ true, %7 ], [ true, %4 ], [ true, %0 ], [ false, %9 ]
%12 = zext i1 %11 to i32
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}
void lsmIoerrBkpt(void) {
  static int nErr = 0;
  nErr++;
}


x86 assembly (clang, -O0):
<lsmIoerrBkpt>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f11(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsmIoerrBkpt>:
addl   $0x1,0x2f1d(%rip)
ret

LLVM IR (-O0):
@lsmIoerrBkpt.nErr = internal global i32 0
define void @lsmIoerrBkpt() {
%1 = load i32, i32* @lsmIoerrBkpt.nErr
%2 = add nsw i32 %1, 1
store i32 %2, i32* @lsmIoerrBkpt.nErr
ret void
}

LLVM IR (-O2):
@lsmIoerrBkpt.nErr = internal unnamed_addr global i32 0
define void @lsmIoerrBkpt() {
%1 = load i32, i32* @lsmIoerrBkpt.nErr
%2 = add nsw i32 %1, 1
store i32 %2, i32* @lsmIoerrBkpt.nErr
ret void
}