xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int ptrdiff_t;

/* Variables and functions */
void *libsais_align_up(const void *address, size_t alignment) {
  return (void *)((((ptrdiff_t)address) + ((ptrdiff_t)alignment) - 1) &
                  (-((ptrdiff_t)alignment)));
}


x86 assembly (clang, -O0):
<libsais_align_up>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
add    %ecx,%eax
sub    $0x1,%eax
mov    -0x10(%rbp),%rcx
mov    %ecx,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
and    %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<libsais_align_up>:
lea    (%rsi,%rdi,1),%eax
add    $0xffffffff,%eax
neg    %esi
and    %eax,%esi
movslq %esi,%rax
ret

LLVM IR (-O0):
define i8* @libsais_align_up(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i32
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = add nsw i32 %6, %8
%10 = sub nsw i32 %9, 1
%11 = load i64, i64* %4
%12 = trunc i64 %11 to i32
%13 = sub nsw i32 0, %12
%14 = and i32 %10, %13
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
ret i8* %16
}

LLVM IR (-O2):
define i8* @libsais_align_up(i8* %0, i64 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = add i64 %1, 4294967295
%5 = add i64 %4, %3
%6 = sub i64 0, %1
%7 = and i64 %5, %6
%8 = shl i64 %7, 32
%9 = ashr exact i64 %8, 32
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_STRING;

/* Variables and functions */
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
int /*<<< orphan*/ DIRECTORYSTRING_it;
ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, const unsigned char **in,
                                 long len) {
  return (ASN1_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                      &DIRECTORYSTRING_it);
}


x86 assembly (clang, -O0):
<d2i_DIRECTORYSTRING>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2eb9(%rip),%rcx
call   1030 <ASN1_item_d2i@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2i_DIRECTORYSTRING>:
mov    0x2ed9(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@DIRECTORYSTRING_it = global i32 0
define i32* @d2i_DIRECTORYSTRING(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @DIRECTORYSTRING_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@DIRECTORYSTRING_it = global i32 0
define i32* @d2i_DIRECTORYSTRING(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @DIRECTORYSTRING_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main() {
  printf("%s", "abc "
               "def "
               "xyz"
               "\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [13 x i8] c"abc def xyz\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [13 x i8] c"abc def xyz\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
t_for() {
  for (int i = 5, j = 2; i + j < 10; j++)
    ;
}


x86 assembly (clang, -O0):
<t_for>:
push   %rbp
mov    %rsp,%rbp
movl   $0x5,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0xa,%eax
jge    1134 <t_for+0x34>
jmp    1126 <t_for+0x26>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1112 <t_for+0x12>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @t_for() {
ret i32 undef
}
/* Variables and functions */
int S_IRWXG;
int S_IRWXO;
int S_IRWXU;
int /*<<< orphan*/ mkdir(char *, int);
void MakeDosDirectories() {
  mkdir("doscar-files", S_IRWXU | S_IRWXG | S_IRWXO);
}


x86 assembly (clang, -O0):
<MakeDosDirectories>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
mov    0x2eb4(%rip),%rax
or     (%rax),%esi
mov    0x2ec3(%rip),%rax
or     (%rax),%esi
lea    0xeca(%rip),%rdi
call   1030 <mkdir@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MakeDosDirectories>:
mov    0x2ec9(%rip),%rax
mov    0x2eba(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2ec7(%rip),%rax
or     (%rax),%esi
lea    0xece(%rip),%rdi
jmp    1030 <mkdir@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"doscar-files\00"
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IRWXO = global i32 0
define void @MakeDosDirectories() {
%1 = load i32, i32* @S_IRWXU
%2 = load i32, i32* @S_IRWXG
%3 = or i32 %1, %2
%4 = load i32, i32* @S_IRWXO
%5 = or i32 %3, %4
%6 = call i32 @mkdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"doscar-files\00"
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IRWXO = global i32 0
define void @MakeDosDirectories() {
%1 = load i32, i32* @S_IRWXU
%2 = load i32, i32* @S_IRWXG
%3 = or i32 %2, %1
%4 = load i32, i32* @S_IRWXO
%5 = or i32 %3, %4
%6 = tail call i32 @mkdir(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int equal_keys(const void *key1, const void *key2) {
  char *k1 = (char *)key1;
  char *k2 = (char *)key2;
  return (0 == strcmp(k1, k2));
}


x86 assembly (clang, -O0):
<equal_keys>:
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),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @equal_keys(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 = load i8*, i8** %6
%11 = call i64 @strcmp(i8* %9, i8* %10)
%12 = icmp eq i64 0, %11
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @equal_keys(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int x = __VERIFIER_nondet_int();
  int y = __VERIFIER_nondet_int();
  if (y < 5) {
    return 0;
  }
  while (x >= 0) {
    y -= 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1149 <main+0x39>
movl   $0x0,-0x4(%rbp)
jmp    116d <main+0x5d>
jmp    114e <main+0x3e>
cmpl   $0x0,-0x8(%rbp)
jl     1166 <main+0x56>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114e <main+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
cmp    $0x5,%eax
jl     1132 <main+0x22>
test   %ebx,%ebx
js     1132 <main+0x22>
nopw   0x0(%rax,%rax,1)
jmp    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = icmp sgt i32 %2, 4
%4 = icmp sgt i32 %1, -1
%5 = select i1 %3, i1 %4, i1 false
br i1 %5, label %6, label %7
6: ; preds = %0, %6
br label %6
7: ; preds = %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, int *);
int strhex2int(char *hex) {
  int num = 0;
  sscanf(hex, "%x", &num);
  return num;
}


x86 assembly (clang, -O0):
<strhex2int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed2(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strhex2int>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xee0(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
define i32 @strhex2int(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
int strlen(char *);
char tolower(char);
char *lowerCase(char word[]) {
  int i = strlen(word);
  int j;
  for (j = 0; j < i; j++) {
    word[j] = tolower(word[j]);
  }
  return word;
}


x86 assembly (clang, -O0):
<lowerCase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1177 <lowerCase+0x57>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113f <lowerCase+0x1f>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowerCase>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1030 <strlen@plt>
test   %eax,%eax
jle    1157 <lowerCase+0x37>
mov    %eax,%r14d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1040 <tolower@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <lowerCase+0x20>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @lowerCase(i8* returned %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call signext i8 @tolower(i8 signext %9)
store i8 %10, i8* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %1
ret i8* %0
}
int qemu_get_aio_context() { return 0; }


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

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

LLVM IR (-O0):
define i32 @qemu_get_aio_context() {
ret i32 0
}

LLVM IR (-O2):
define i32 @qemu_get_aio_context() {
ret i32 0
}
__attribute__((no, noclone)) int f1(int x) {
#pragma omp taskloop firstprivate(x) lastprivate(x)
  for (int i = 0; i < 64; i++) {
    if (x != 74)
      __builtin_abort();
    if (i == 63)
      x = i + 4;
  }
  return x;
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jge    1161 <f1+0x51>
cmpl   $0x4a,-0x4(%rbp)
je     113b <f1+0x2b>
call   1030 <abort@plt>
cmpl   $0x3f,-0x8(%rbp)
jne    114e <f1+0x3e>
mov    -0x8(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <f1+0x43>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <f1+0x12>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
mov    $0x40,%eax
mov    $0x43,%ecx
nopw   0x0(%rax,%rax,1)
cmp    $0x4a,%edi
jne    1138 <f1+0x28>
cmp    $0x4,%eax
mov    $0x4a,%edi
cmove  %ecx,%edi
add    $0xfffffffc,%eax
jne    1120 <f1+0x10>
mov    %edi,%eax
ret
push   %rax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @f1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %18, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 64
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 74
br i1 %9, label %10, label %11
10: ; preds = %7
unreachable
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 63
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 4
store i32 %16, i32* %2
br label %17
17: ; preds = %14, %11
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %4
21: ; preds = %4
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @f1(i32 %0) {
br label %3
2: ; preds = %8
ret i32 %10
3: ; preds = %8, %1
%4 = phi i32 [ 0, %1 ], [ %11, %8 ]
%5 = phi i32 [ %0, %1 ], [ %10, %8 ]
%6 = icmp eq i32 %5, 74
br i1 %6, label %8, label %7
7: ; preds = %3
tail call void @abort()
unreachable
8: ; preds = %3
%9 = icmp eq i32 %4, 60
%10 = select i1 %9, i32 67, i32 74
%11 = add nuw nsw i32 %4, 4
%12 = icmp eq i32 %11, 64
br i1 %12, label %2, label %3
}
int test_imm_C2int64_lowword_reg(long long val) {
  return ((val) & (0xC2 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_C2int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 194
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ sys_subshell();
void sys_suspend() { sys_subshell(); }


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

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

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

LLVM IR (-O2):
define void @sys_suspend() {
%1 = tail call i32 (...) @sys_subshell()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430GeneralIOP__36__IO__makeOutput();
void Msp430GpioC__0__HplGeneralIO__makeOutput(void) {
  HplMsp430GeneralIOP__36__IO__makeOutput();
}


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

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

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

LLVM IR (-O2):
define void @Msp430GpioC__0__HplGeneralIO__makeOutput() {
%1 = tail call i32 (...) @HplMsp430GeneralIOP__36__IO__makeOutput()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
struct _Locale_ctype {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ towupper(int /*<<< orphan*/);
wint_t _WLocale_toupper(struct _Locale_ctype *lctype
                        __attribute__((__unused__)),
                        wint_t wc) {
  return towupper(wc);
}


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

x86 assembly (clang, -O2):
<_WLocale_toupper>:
mov    %esi,%edi
jmp    1030 <towupper@plt>

LLVM IR (-O0):
%struct._Locale_ctype = type { i32 }
define i32 @_WLocale_toupper(%struct._Locale_ctype* %0, i32 %1) {
%3 = alloca %struct._Locale_ctype*
%4 = alloca i32
store %struct._Locale_ctype* %0, %struct._Locale_ctype** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @towupper(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
%struct._Locale_ctype = type { i32 }
define i32 @_WLocale_toupper(%struct._Locale_ctype* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @towupper(i32 %1)
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ int8_t;

/* Variables and functions */
void ref_sub_int8_t(int8_t arg1, int8_t arg2, int8_t *result) {
  *result = arg1 - arg2;
}


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

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

LLVM IR (-O0):
define void @ref_sub_int8_t(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 = sub nsw i64 %7, %8
%10 = load i64*, i64** %6
store i64 %9, i64* %10
ret void
}

LLVM IR (-O2):
define void @ref_sub_int8_t(i64 %0, i64 %1, i64* nocapture writeonly %2) {
%4 = sub nsw i64 %0, %1
store i64 %4, i64* %2
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_THREAD_CPUTIME_ID;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
void stopwatch_start(struct timespec *t) {
  clock_gettime(CLOCK_THREAD_CPUTIME_ID, t);
}


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

x86 assembly (clang, -O2):
<stopwatch_start>:
mov    %rdi,%rsi
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
jmp    1030 <clock_gettime@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_THREAD_CPUTIME_ID = global i32 0
define void @stopwatch_start(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%4 = load %struct.timespec*, %struct.timespec** %2
%5 = call i32 @clock_gettime(i32 %3, %struct.timespec* %4)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_THREAD_CPUTIME_ID = global i32 0
define void @stopwatch_start(%struct.timespec* %0) {
%2 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%3 = tail call i32 @clock_gettime(i32 %2, %struct.timespec* %0)
ret void
}
long int to_signed_long(unsigned long int value) {
  long int signed_value = value;
  if (value >> 31)
    signed_value |= -1 << 31;
  return signed_value;
}


x86 assembly (clang, -O0):
<to_signed_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1f,%rax
cmp    $0x0,%rax
je     1130 <to_signed_long+0x30>
mov    -0x10(%rbp),%rax
or     $0xffffffff80000000,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_signed_long>:
mov    %rdi,%rax
or     $0xffffffff80000000,%rax
test   $0xffffffff80000000,%rdi
cmove  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @to_signed_long(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
store i64 %4, i64* %3
%5 = load i64, i64* %2
%6 = lshr i64 %5, 31
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i64, i64* %3
%10 = or i64 %9, -2147483648
store i64 %10, i64* %3
br label %11
11: ; preds = %8, %1
%12 = load i64, i64* %3
ret i64 %12
}

LLVM IR (-O2):
define i64 @to_signed_long(i64 %0) {
%2 = icmp ult i64 %0, 2147483648
%3 = or i64 %0, -2147483648
%4 = select i1 %2, i64 %0, i64 %3
ret i64 %4
}
void hex_to_string(void) {}


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

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

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

LLVM IR (-O2):
define void @hex_to_string() {
ret void
}
unsigned char *advanceToEmbeddingArea(unsigned char *ptr) {
  for (int i = 0; i < 3; i++) {
    while (*ptr != '\n') {
      ptr += sizeof(char);
    }
    ptr += sizeof(char);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<advanceToEmbeddingArea>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1159 <advanceToEmbeddingArea+0x59>
jmp    111e <advanceToEmbeddingArea+0x1e>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xa,%eax
je     113f <advanceToEmbeddingArea+0x3f>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111e <advanceToEmbeddingArea+0x1e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <advanceToEmbeddingArea+0xf>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<advanceToEmbeddingArea>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpb   $0xa,(%rax)
lea    0x1(%rax),%rax
jne    1110 <advanceToEmbeddingArea+0x10>
nopl   0x0(%rax)
cmpb   $0xa,(%rax)
lea    0x1(%rax),%rax
jne    1120 <advanceToEmbeddingArea+0x20>
nopl   0x0(%rax)
cmpb   $0xa,(%rax)
lea    0x1(%rax),%rax
jne    1130 <advanceToEmbeddingArea+0x30>
ret

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

LLVM IR (-O2):
define i8* @advanceToEmbeddingArea(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %6, %2 ], [ %0, %1 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 10
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2, %7
%8 = phi i8* [ %11, %7 ], [ %6, %2 ]
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 10
%11 = getelementptr inbounds i8, i8* %8, i64 1
br i1 %10, label %12, label %7
12: ; preds = %7, %12
%13 = phi i8* [ %16, %12 ], [ %11, %7 ]
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 10
%16 = getelementptr inbounds i8, i8* %13, i64 1
br i1 %15, label %17, label %12
17: ; preds = %12
ret i8* %16
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void logstring(int logfd, char *str) { write(logfd, str, strlen(str)); }


x86 assembly (clang, -O0):
<logstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logstring>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @logstring(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @write(i32 %5, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
define void @logstring(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usage();
int /*<<< orphan*/ write_file(char const *);
void do_write_file(int argc, char *argv[]) {
  if (argc != 1)
    usage();
  const char *filename = argv[0];
  write_file(filename);
}


x86 assembly (clang, -O0):
<do_write_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
je     1140 <do_write_file+0x20>
mov    $0x0,%al
call   1040 <usage@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <write_file@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_write_file>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
je     1130 <do_write_file+0x10>
xor    %eax,%eax
call   1040 <usage@plt>
mov    (%rbx),%rdi
pop    %rbx
jmp    1030 <write_file@plt>

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

LLVM IR (-O2):
define void @do_write_file(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %6
6: ; preds = %4, %2
%7 = load i8*, i8** %1
%8 = tail call i32 @write_file(i8* %7)
ret void
}
void CDAudio_Shutdown(void) {}


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

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

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

LLVM IR (-O2):
define void @CDAudio_Shutdown() {
ret void
}
void f(int x) {}


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

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

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

LLVM IR (-O2):
define void @f(i32 %0) {
ret void
}
int bltInstruction(int i, int j) { return (i < j) ? 1 : 0; }


x86 assembly (clang, -O0):
<bltInstruction>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bltInstruction>:
xor    %eax,%eax
cmp    %esi,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @bltInstruction(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 = icmp slt i32 %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 1, i32 0
ret i32 %9
}

LLVM IR (-O2):
define i32 @bltInstruction(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void dm_send_uevents(struct list_head *events, struct kobject *kobj) {}


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

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

LLVM IR (-O0):
%struct.list_head = type opaque
%struct.kobject = type opaque
define void @dm_send_uevents(%struct.list_head* %0, %struct.kobject* %1) {
%3 = alloca %struct.list_head*
%4 = alloca %struct.kobject*
store %struct.list_head* %0, %struct.list_head** %3
store %struct.kobject* %1, %struct.kobject** %4
ret void
}

LLVM IR (-O2):
%struct.list_head = type opaque
%struct.kobject = type opaque
define void @dm_send_uevents(%struct.list_head* nocapture %0, %struct.kobject* nocapture %1) {
ret void
}
/* Type definitions */
struct symtab {
  int dummy;
};

/* Variables and functions */
int symtab_get(struct symtab *, char const *, int *, int *);
int symtab_get_t(struct symtab *tab, const char *name, int type, int *pdata) {
  int rtype;
  int res = symtab_get(tab, name, &rtype, pdata);
  if (res == -1)
    return res;
  if (rtype != type)
    return -1;
  return res;
}


x86 assembly (clang, -O0):
<symtab_get_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%rdx
call   1030 <symtab_get@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    1154 <symtab_get_t+0x44>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1172 <symtab_get_t+0x62>
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     116c <symtab_get_t+0x5c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1172 <symtab_get_t+0x62>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<symtab_get_t>:
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebx
lea    0xc(%rsp),%rdx
call   1030 <symtab_get@plt>
cmp    %ebx,0xc(%rsp)
mov    $0xffffffff,%ecx
cmove  %eax,%ecx
cmp    $0xffffffff,%eax
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.symtab = type { i32 }
define i32 @symtab_get_t(%struct.symtab* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca %struct.symtab*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
store %struct.symtab* %0, %struct.symtab** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
%12 = load %struct.symtab*, %struct.symtab** %6
%13 = load i8*, i8** %7
%14 = load i32*, i32** %9
%15 = call i32 @symtab_get(%struct.symtab* %12, i8* %13, i32* %10, i32* %14)
store i32 %15, i32* %11
%16 = load i32, i32* %11
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %20
18: ; preds = %4
%19 = load i32, i32* %11
store i32 %19, i32* %5
br label %27
20: ; preds = %4
%21 = load i32, i32* %10
%22 = load i32, i32* %8
%23 = icmp ne i32 %21, %22
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 -1, i32* %5
br label %27
25: ; preds = %20
%26 = load i32, i32* %11
store i32 %26, i32* %5
br label %27
27: ; preds = %25, %24, %18
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
%struct.symtab = type { i32 }
define i32 @symtab_get_t(%struct.symtab* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = call i32 @symtab_get(%struct.symtab* %0, i8* %1, i32* %5, i32* %3)
%8 = icmp eq i32 %7, -1
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, %2
%11 = select i1 %10, i32 %7, i32 -1
%12 = select i1 %8, i32 -1, i32 %11
ret i32 %12
}
unsigned int dma_set(unsigned int *dma_virtual_address, int offset,
                     unsigned int value) {
  dma_virtual_address[offset >> 2] = value;
}


x86 assembly (clang, -O0):
<dma_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sar    $0x2,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dma_set>:
sar    $0x2,%esi
movslq %esi,%rax
mov    %edx,(%rdi,%rax,4)
ret

LLVM IR (-O0):
define i32 @dma_set(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = ashr i32 %10, 2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %9, i64 %12
store i32 %8, i32* %13
%14 = load i32, i32* %4
ret i32 %14
}

LLVM IR (-O2):
define i32 @dma_set(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = ashr i32 %1, 2
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 %2, i32* %6
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int usage(char *self) {
  printf("Usage: %s <config>\n", self);
  return 1;
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Usage: %s <config>\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 1
}

LLVM IR (-O2):
@.str = [20 x i8] c"Usage: %s <config>\0A\00"
define i32 @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ execl(char *, char *, int /*<<< orphan*/ *);
void exec_shell(int sock) {
  dup2(sock, 0);
  dup2(sock, 1);
  dup2(sock, 2);
  execl("/bin/sh", "sh", NULL);
}


x86 assembly (clang, -O0):
<exec_shell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1030 <dup2@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <dup2@plt>
lea    0xeaa(%rip),%rdi
lea    0xea8(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <execl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exec_shell>:
push   %rbx
mov    %edi,%ebx
xor    %esi,%esi
call   1030 <dup2@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
mov    %ebx,%edi
mov    $0x2,%esi
call   1030 <dup2@plt>
lea    0xeb7(%rip),%rdi
lea    0xeb5(%rip),%rsi
xor    %edx,%edx
pop    %rbx
jmp    1040 <execl@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/sh\00"
@.str.1 = [3 x i8] c"sh\00"
define void @exec_shell(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @dup2(i32 %3, i32 0)
%5 = load i32, i32* %2
%6 = call i32 @dup2(i32 %5, i32 1)
%7 = load i32, i32* %2
%8 = call i32 @dup2(i32 %7, i32 2)
%9 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
@.str.1 = [3 x i8] c"sh\00"
define void @exec_shell(i32 %0) {
%2 = tail call i32 @dup2(i32 %0, i32 0)
%3 = tail call i32 @dup2(i32 %0, i32 1)
%4 = tail call i32 @dup2(i32 %0, i32 2)
%5 = tail call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret void
}
void myth_log_fini(void) {}


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

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

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

LLVM IR (-O2):
define void @myth_log_fini() {
ret void
}
int string_length(char *string) {
  char *s;
  for (s = string; *s; ++s)
    ;
  return (s - string);
}


x86 assembly (clang, -O0):
<string_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1133 <string_length+0x33>
jmp    1122 <string_length+0x22>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <string_length+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_length>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <string_length+0x10>
ret

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

LLVM IR (-O2):
define i32 @string_length(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void PWMFaultIntUnregister(unsigned long ulBase) {
  ;
  IntDisable(25);
  IntUnregister(25);
}


x86 assembly (clang, -O0):
<PWMFaultIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x19,%edi
call   1030 <IntDisable@plt>
mov    $0x19,%edi
call   1040 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMFaultIntUnregister>:
push   %rax
mov    $0x19,%edi
call   1030 <IntDisable@plt>
mov    $0x19,%edi
pop    %rax
jmp    1040 <IntUnregister@plt>

LLVM IR (-O0):
define void @PWMFaultIntUnregister(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @IntDisable(i32 25)
%4 = call i32 @IntUnregister(i32 25)
ret void
}

LLVM IR (-O2):
define void @PWMFaultIntUnregister(i64 %0) {
%2 = tail call i32 @IntDisable(i32 25)
%3 = tail call i32 @IntUnregister(i32 25)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ process_arguments(int, char **);
int main(int argc, char *argv[]) { process_arguments(argc, argv); }


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @process_arguments(i32 %0, i8** %1)
ret i32 0
}
/* Variables and functions */
char *EncodeHttp(char const *, int, int);
char *httpize(const char *z, int n) { return EncodeHttp(z, n, 1); }


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

x86 assembly (clang, -O2):
<httpize>:
mov    $0x1,%edx
jmp    1030 <EncodeHttp@plt>

LLVM IR (-O0):
define i8* @httpize(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 i8* @EncodeHttp(i8* %5, i32 %6, i32 1)
ret i8* %7
}

LLVM IR (-O2):
define i8* @httpize(i8* %0, i32 %1) {
%3 = tail call i8* @EncodeHttp(i8* %0, i32 %1, i32 1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ pass1(char *);
int /*<<< orphan*/ pass2(char *, char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printf("as0m <asmFile> <objFile>\n");
    exit(1);
  }
  char *asmFile = argv[1], *objFile = argv[2];
  pass1(asmFile);
  pass2(asmFile, objFile);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
je     116f <main+0x2f>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <pass1@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <pass2@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    116e <main+0x2e>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
mov    %rbx,%rdi
call   1060 <pass1@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <pass2@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"as0m <asmFile> <objFile>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %5
%16 = load i8**, i8*** %4
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
store i8* %18, i8** %6
%19 = load i8*, i8** %5
%20 = call i32 @pass1(i8* %19)
%21 = load i8*, i8** %5
%22 = load i8*, i8** %6
%23 = call i32 @pass2(i8* %21, i8* %22)
ret i32 0
}

LLVM IR (-O2):
@str = [25 x i8] c"as0m <asmFile> <objFile>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @pass1(i8* %9)
%13 = tail call i32 @pass2(i8* %9, i8* %11)
ret i32 0
}
void SteamAPI_ISteamHTMLSurface_GetLinkAtPosition(void *self) {
  xlogf("%s(self = %p)\n", __func__, self);
}


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

x86 assembly (clang, -O2):
<SteamAPI_ISteamHTMLSurface_GetLinkAtPosition>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamHTMLSurface_GetLinkAtPosition = [45 x i8] c"SteamAPI_ISteamHTMLSurface_GetLinkAtPosition\00"
define void @SteamAPI_ISteamHTMLSurface_GetLinkAtPosition(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @__func__.SteamAPI_ISteamHTMLSurface_GetLinkAtPosition, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamHTMLSurface_GetLinkAtPosition = [45 x i8] c"SteamAPI_ISteamHTMLSurface_GetLinkAtPosition\00"
define void @SteamAPI_ISteamHTMLSurface_GetLinkAtPosition(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @__func__.SteamAPI_ISteamHTMLSurface_GetLinkAtPosition, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void test_error(char *name) { printf("error: %s\n", name); }


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"error: %s\0A\00"
define void @test_error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}