xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  switch (1) {
  case 1:
    printf("pangus");
  default:
    printf("default");
  }
  printf("return");
  return 0;
}


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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"pangus\00"
@.str.1 = [8 x i8] c"default\00"
@.str.2 = [7 x i8] c"return\00"
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 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"pangus\00"
@.str.1 = [8 x i8] c"default\00"
@.str.2 = [7 x i8] c"return\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
double sin(double x) { return x - ((x * x) / (1 * 2 * 3)); }


x86 assembly (clang, -O0):
<sin>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xee0(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sin>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
divsd  0xef0(%rip),%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @sin(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = fdiv double %6, 6.000000e+00
%8 = fsub double %3, %7
ret double %8
}

LLVM IR (-O2):
define double @sin(double %0) {
%2 = fmul double %0, %0
%3 = fdiv double %2, 6.000000e+00
%4 = fsub double %0, %3
ret double %4
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int __infer_nondet_int();
int vfwprintf(FILE *stream, const wchar_t *format, va_list arg) {
  int res;
  res = __infer_nondet_int();
  if (res < 0)
    while (1)
      ;
  return res;
}


x86 assembly (clang, -O0):
<vfwprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1141 <vfwprintf+0x31>
jmp    113c <vfwprintf+0x2c>
jmp    113c <vfwprintf+0x2c>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vfwprintf>:
push   %rax
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
test   %eax,%eax
js     1120 <vfwprintf+0x10>
pop    %rcx
ret
xchg   %ax,%ax
jmp    1120 <vfwprintf+0x10>

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

LLVM IR (-O2):
define i32 @vfwprintf(i32* nocapture readnone %0, i32* nocapture readnone %1, i32 %2) {
%4 = tail call i32 (...) @__infer_nondet_int()
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %3, %6
br label %6
7: ; preds = %3
ret i32 %4
}
int vdeFun_n_out(void) { return 3; }


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

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

LLVM IR (-O0):
define i32 @vdeFun_n_out() {
ret i32 3
}

LLVM IR (-O2):
define i32 @vdeFun_n_out() {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, unsigned int);
void formatUInt32(char *buffer, size_t size, char *format, unsigned int v) {
  snprintf(buffer, size, format, v);
}


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

x86 assembly (clang, -O2):
<formatUInt32>:
jmp    1030 <snprintf@plt>

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

LLVM IR (-O2):
define void @formatUInt32(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = tail call i32 @snprintf(i8* %0, i64 %1, i8* %2, i32 %3)
ret void
}
int f2fs_init_iostat_processing(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @f2fs_init_iostat_processing() {
ret i32 0
}
int execute_setfsuid() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_setfsuid() {
ret i32 0
}
void RTVfsIoStrmIsAtEnd(void) {}


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

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

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

LLVM IR (-O2):
define void @RTVfsIoStrmIsAtEnd() {
ret void
}
/* Variables and functions */
char *salloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *astrcpy(char *str) {
  char *newbuf;
  int bytes;
  if (!str)
    str = "";
  bytes = strlen(str);
  newbuf = salloc(bytes + 1);
  strcpy(newbuf, str);
  return newbuf;
}


x86 assembly (clang, -O0):
<astrcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1152 <astrcpy+0x22>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1050 <salloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<astrcpy>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
lea    0xec2(%rip),%rbx
cmovne %rdi,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <salloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @astrcpy(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %1
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
%13 = call i8* @salloc(i32 %12)
store i8* %13, i8** %3
%14 = load i8*, i8** %3
%15 = load i8*, i8** %2
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @astrcpy(i8* %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
%4 = tail call i32 @strlen(i8* %3)
%5 = add nsw i32 %4, 1
%6 = tail call i8* @salloc(i32 %5)
%7 = tail call i32 @strcpy(i8* %6, i8* %3)
ret i8* %6
}
int writeStringToBuffer(char *string, char *buf, int bufIndex) {
  int i = 0;
  bufIndex--;
  while (string[i] != '\0') {
    buf[++bufIndex] = string[i];
    ++i;
  }
  return 1;
}


x86 assembly (clang, -O0):
<writeStringToBuffer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1160 <writeStringToBuffer+0x60>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    111f <writeStringToBuffer+0x1f>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeStringToBuffer>:
mov    (%rdi),%al
test   %al,%al
je     112f <writeStringToBuffer+0x2f>
add    $0xffffffff,%edx
movslq %edx,%rcx
add    %rcx,%rsi
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %al,(%rsi,%rcx,1)
movzbl (%rdi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1120 <writeStringToBuffer+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @writeStringToBuffer(i8* nocapture %0, i8* nocapture writeonly %1, i32 %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %3
%7 = add i32 %2, -1
%8 = sext i32 %7 to i64
br label %9
9: ; preds = %6, %9
%10 = phi i64 [ %8, %6 ], [ %13, %9 ]
%11 = phi i64 [ 0, %6 ], [ %15, %9 ]
%12 = phi i8 [ %4, %6 ], [ %17, %9 ]
%13 = add i64 %10, 1
%14 = getelementptr inbounds i8, i8* %1, i64 %13
store i8 %12, i8* %14
%15 = add nuw nsw i64 %11, 1
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %9
19: ; preds = %9, %3
ret i32 1
}
void gtk_message_dialog_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_message_dialog_get_type() {
ret void
}
void foo722() {}


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

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

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

LLVM IR (-O2):
define void @foo722() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tnlRequestSubOption(int);
void cmdSelectDevice(int argc, char *argv[]) { tnlRequestSubOption(131); }


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

x86 assembly (clang, -O2):
<cmdSelectDevice>:
mov    $0x83,%edi
jmp    1030 <tnlRequestSubOption@plt>

LLVM IR (-O0):
define void @cmdSelectDevice(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @tnlRequestSubOption(i32 131)
ret void
}

LLVM IR (-O2):
define void @cmdSelectDevice(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @tnlRequestSubOption(i32 131)
ret void
}
int count_occurrences(const char *s1, char c) {
  const char *ptr = s1;
  int n = 0;
  do {
    if (*ptr == c)
      n++;
  } while (*(ptr++));
  return n;
}


x86 assembly (clang, -O0):
<count_occurrences>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1139 <count_occurrences+0x39>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113e <count_occurrences+0x3e>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
cmpb   $0x0,(%rax)
jne    111d <count_occurrences+0x1d>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_occurrences>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi),%ecx
xor    %edx,%edx
cmp    %sil,%cl
sete   %dl
add    %edx,%eax
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <count_occurrences+0x10>
ret

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

LLVM IR (-O2):
define i32 @count_occurrences(i8* nocapture %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %10, %3 ]
%5 = phi i32 [ 0, %2 ], [ %9, %3 ]
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, %1
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %5, %8
%10 = getelementptr inbounds i8, i8* %4, i64 1
%11 = icmp eq i8 %6, 0
br i1 %11, label %12, label %3
12: ; preds = %3
ret i32 %9
}
int test_imm_BCint8_mem(signed char *val) {
  return ((*val) & (0xBC << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BCint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -68
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, char, size_t);
size_t strftime(char *, size_t, char const *, int /*<<< orphan*/);
const char *timestamp2string(char *str, size_t size, time_t timestamp,
                             const char *format) {
  size_t len = strftime(str, size, format, localtime(&timestamp));
  memset(str + len, '\0', size - len);
  return str;
}


x86 assembly (clang, -O0):
<timestamp2string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    %eax,%ecx
call   1050 <strftime@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
add    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rdx
sub    -0x28(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timestamp2string>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %edx,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
call   1050 <strftime@plt>
lea    (%r15,%rax,1),%rdi
sub    %rax,%rbx
xor    %esi,%esi
mov    %rbx,%rdx
call   1040 <memset@plt>
mov    %r15,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @timestamp2string(i8* %0, i64 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = load i8*, i8** %8
%13 = call i32 @localtime(i32* %7)
%14 = call i64 @strftime(i8* %10, i64 %11, i8* %12, i32 %13)
store i64 %14, i64* %9
%15 = load i8*, i8** %5
%16 = load i64, i64* %9
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i64, i64* %6
%19 = load i64, i64* %9
%20 = sub i64 %18, %19
%21 = call i32 @memset(i8* %17, i8 signext 0, i64 %20)
%22 = load i8*, i8** %5
ret i8* %22
}

LLVM IR (-O2):
define i8* @timestamp2string(i8* returned %0, i64 %1, i32 %2, i8* %3) {
%5 = alloca i32
store i32 %2, i32* %5
%6 = call i32 @localtime(i32* %5)
%7 = call i64 @strftime(i8* %0, i64 %1, i8* %3, i32 %6)
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = sub i64 %1, %7
%10 = call i32 @memset(i8* %8, i8 signext 0, i64 %9)
ret i8* %0
}
unsigned make_bitfield(unsigned data, unsigned offset, unsigned bitsize) {
  return (data & ((1 << bitsize) - 1)) << offset;
}


x86 assembly (clang, -O0):
<make_bitfield>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_bitfield>:
mov    %edx,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
and    %edi,%eax
mov    %esi,%ecx
shl    %cl,%eax
ret

LLVM IR (-O0):
define i32 @make_bitfield(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %6
%9 = shl i32 1, %8
%10 = sub nsw i32 %9, 1
%11 = and i32 %7, %10
%12 = load i32, i32* %5
%13 = shl i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @make_bitfield(i32 %0, i32 %1, i32 %2) {
%4 = shl nsw i32 -1, %2
%5 = xor i32 %4, -1
%6 = and i32 %5, %0
%7 = shl i32 %6, %1
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
long getFileSize(FILE *file) {
  fseek(file, 0, SEEK_END);
  long lSize = ftell(file);
  printf("File size: %ld\n", lSize);
  rewind(file);
  return lSize;
}


x86 assembly (clang, -O0):
<getFileSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1050 <ftell@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <rewind@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFileSize>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <fseek@plt>
mov    %rbx,%rdi
call   1050 <ftell@plt>
mov    %rax,%r14
lea    0xe97(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <rewind@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@.str = [16 x i8] c"File size: %ld\0A\00"
define i64 @getFileSize(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* @SEEK_END
%6 = call i32 @fseek(i32* %4, i32 0, i32 %5)
%7 = load i32*, i32** %2
%8 = call i64 @ftell(i32* %7)
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = load i32*, i32** %2
%12 = call i32 @rewind(i32* %11)
%13 = load i64, i64* %3
ret i64 %13
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@.str = [16 x i8] c"File size: %ld\0A\00"
define i64 @getFileSize(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32* %0, i32 0, i32 %2)
%4 = tail call i64 @ftell(i32* %0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %4)
%6 = tail call i32 @rewind(i32* %0)
ret i64 %4
}
/* Variables and functions */
double SIM_power_gatecap(double, int);
double SIM_array_comp_chgaddr_cap(void) {
  return (SIM_power_gatecap((20.0 * 0.0875), 1));
}


x86 assembly (clang, -O0):
<SIM_array_comp_chgaddr_cap>:
push   %rbp
mov    %rsp,%rbp
movsd  0xee4(%rip),%xmm0
mov    $0x1,%edi
call   1030 <SIM_power_gatecap@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SIM_array_comp_chgaddr_cap>:
movsd  0xee8(%rip),%xmm0
mov    $0x1,%edi
jmp    1030 <SIM_power_gatecap@plt>

LLVM IR (-O0):
define double @SIM_array_comp_chgaddr_cap() {
%1 = call double @SIM_power_gatecap(double 1.750000e+00, i32 1)
ret double %1
}

LLVM IR (-O2):
define double @SIM_array_comp_chgaddr_cap() {
%1 = tail call double @SIM_power_gatecap(double 1.750000e+00, i32 1)
ret double %1
}
/* Variables and functions */
scalar_t__ sancus_get_lls(char const *, long long *);
int sancus_get_urll(long long, long long, long long, unsigned int *);
bool sancus_get_urlls(const char *s, long long a, long long b, unsigned *out) {
  long long v;
  bool ret = false;
  if (sancus_get_lls(s, &v))
    ret = sancus_get_urll(v, a, b, out);
  return ret;
}


x86 assembly (clang, -O0):
<sancus_get_urlls>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <sancus_get_lls@plt>
cmp    $0x0,%rax
je     116e <sancus_get_urlls+0x4e>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <sancus_get_urll@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sancus_get_urlls>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
call   1040 <sancus_get_lls@plt>
test   %rax,%rax
je     1156 <sancus_get_urlls+0x36>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <sancus_get_urll@plt>
jmp    1158 <sancus_get_urlls+0x38>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @sancus_get_urlls(i8* %0, i64 %1, i64 %2, i32* %3) {
%5 = alloca i64
%6 = bitcast i64* %5 to i8*
%7 = call i64 @sancus_get_lls(i8* %0, i64* %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = load i64, i64* %5
%11 = call i32 @sancus_get_urll(i64 %10, i64 %1, i64 %2, i32* %3)
br label %12
12: ; preds = %9, %4
%13 = phi i32 [ %11, %9 ], [ 0, %4 ]
ret i32 %13
}
void glGetMaterialfv(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glGetMaterialfv() {
ret void
}
I0R1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{
  if (22 <= r1)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<I0R1>:
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    $0x16,%eax
cmp    -0xc(%rbp),%eax
jg     1132 <I0R1+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1139 <I0R1+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<I0R1>:
xor    %eax,%eax
cmp    $0x16,%esi
setge  %al
ret

LLVM IR (-O0):
define i32 @I0R1(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* %9
%15 = icmp sle i32 22, %14
br i1 %15, label %16, label %17
16: ; preds = %6
store i32 1, i32* %7
br label %18
17: ; preds = %6
store i32 0, i32* %7
br label %18
18: ; preds = %17, %16
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
define i32 @I0R1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture readnone %4, i32* nocapture readnone %5) {
%7 = icmp sgt i32 %1, 21
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ fn_glutTimerFunc(unsigned int, void *, int);
void glutTimerFunc(unsigned int millis, void *fn, int value) {
  fn_glutTimerFunc(millis, fn, value);
}


x86 assembly (clang, -O0):
<glutTimerFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <fn_glutTimerFunc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glutTimerFunc>:
jmp    1030 <fn_glutTimerFunc@plt>

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

LLVM IR (-O2):
define void @glutTimerFunc(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @fn_glutTimerFunc(i32 %0, i8* %1, i32 %2)
ret void
}
void handle_sigstp(int signal) {}


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

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

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

LLVM IR (-O2):
define void @handle_sigstp(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ llabs(long long);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int scanf(char *, long long *, long long *);
int main(void) {
  long long a, b;
  while (scanf("%lld%lld", &a, &b) == 2)
    printf("%lld\n", llabs(a - b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    117c <main+0x4c>
mov    -0x10(%rbp),%rdi
sub    -0x18(%rbp),%rdi
call   1040 <llabs@plt>
mov    %eax,%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebe(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    119c <main+0x6c>
lea    0xeac(%rip),%r14
lea    0xe9c(%rip),%r15
lea    0x10(%rsp),%r12
lea    0x8(%rsp),%rbx
xchg   %ax,%ax
mov    0x10(%rsp),%rdi
sub    0x8(%rsp),%rdi
call   1040 <llabs@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
je     1170 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%lld%lld\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %15
7: ; preds = %0, %7
%8 = load i64, i64* %1
%9 = load i64, i64* %2
%10 = sub nsw i64 %8, %9
%11 = call i32 @llabs(i64 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%14 = icmp eq i32 %13, 2
br i1 %14, label %7, label %15
15: ; preds = %7, %0
ret i32 0
}
void avpriv_solve_lls() {}


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

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

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

LLVM IR (-O2):
define void @avpriv_solve_lls() {
ret void
}
unsigned int bit_zero_contagious_uint(unsigned int val) {
  return (((val) << 1) & (val) & ((val) >> 1));
}


x86 assembly (clang, -O0):
<bit_zero_contagious_uint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
and    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_zero_contagious_uint>:
lea    (%rdi,%rdi,1),%eax
and    %edi,%eax
shr    %edi
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @bit_zero_contagious_uint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 1
%5 = load i32, i32* %2
%6 = and i32 %4, %5
%7 = load i32, i32* %2
%8 = lshr i32 %7, 1
%9 = and i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @bit_zero_contagious_uint(i32 %0) {
%2 = shl i32 %0, 1
%3 = and i32 %2, %0
%4 = lshr i32 %0, 1
%5 = and i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ appendCODE(int /*<<< orphan*/);
int /*<<< orphan*/ makeCODEputfield(char *, int /*<<< orphan*/ *);
void code_putfield(char *arg) { appendCODE(makeCODEputfield(arg, NULL)); }


x86 assembly (clang, -O0):
<code_putfield>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <makeCODEputfield@plt>
mov    %eax,%edi
call   1030 <appendCODE@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<code_putfield>:
push   %rax
xor    %esi,%esi
call   1040 <makeCODEputfield@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <appendCODE@plt>

LLVM IR (-O0):
define void @code_putfield(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @makeCODEputfield(i8* %3, i32* null)
%5 = call i32 @appendCODE(i32 %4)
ret void
}

LLVM IR (-O2):
define void @code_putfield(i8* %0) {
%2 = tail call i32 @makeCODEputfield(i8* %0, i32* null)
%3 = tail call i32 @appendCODE(i32 %2)
ret void
}
/* Variables and functions */
char *ft_strchr(char *, char);
int ichr(char *cs, char c) {
  char *f;
  f = ft_strchr(cs, c);
  return (f ? f - cs : -1);
}


x86 assembly (clang, -O0):
<ichr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <ft_strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1152 <ichr+0x42>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    1162 <ichr+0x52>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1162 <ichr+0x52>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ichr>:
push   %rbx
mov    %rdi,%rbx
call   1030 <ft_strchr@plt>
mov    %eax,%ecx
sub    %ebx,%ecx
cmp    $0x1,%rax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ichr(i8* %0, i8 signext %1) {
%3 = tail call i8* @ft_strchr(i8* %0, i8 signext %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = select i1 %4, i32 -1, i32 %8
ret i32 %9
}
unsigned int foo(unsigned int i, unsigned int x, unsigned int y) {
  return i < (((x) <= (y)) ? (x) : (y));
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
ja     112a <foo+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1130 <foo+0x30>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ecx
cmp    %ecx,%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    %edx,%esi
cmova  %edx,%esi
xor    %eax,%eax
cmp    %edi,%esi
seta   %al
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1, i32 %2) {
%4 = icmp ugt i32 %1, %2
%5 = select i1 %4, i32 %2, i32 %1
%6 = icmp ugt i32 %5, %0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void testmain() { print("noreturn"); }


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

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

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

LLVM IR (-O2):
@.str = [9 x i8] c"noreturn\00"
define void @testmain() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UART0_PutChar(int);
void UART0_SendData8(unsigned char data) {
  int hundreds = data / 100;
  int tens = data % 100 / 10;
  int digits = data % 10;
  UART0_PutChar(hundreds + '0');
  UART0_PutChar(tens + '0');
  UART0_PutChar(digits + '0');
}


x86 assembly (clang, -O0):
<UART0_SendData8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
add    $0x30,%edi
call   1030 <UART0_PutChar@plt>
mov    -0xc(%rbp),%edi
add    $0x30,%edi
call   1030 <UART0_PutChar@plt>
mov    -0x10(%rbp),%edi
add    $0x30,%edi
call   1030 <UART0_PutChar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UART0_SendData8>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    (%rbx,%rbx,4),%eax
lea    (%rbx,%rax,8),%eax
shr    $0xc,%eax
imul   $0x64,%eax,%ecx
mov    %ebx,%edx
sub    %cl,%dl
movzbl %dl,%ecx
imul   $0xcd,%ecx,%ebp
shr    $0xb,%ebp
imul   $0xcd,%edi,%ecx
shr    $0xa,%ecx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%bl
or     $0x30,%al
movzbl %al,%edi
call   1030 <UART0_PutChar@plt>
or     $0x30,%bpl
movzbl %bpl,%edi
call   1030 <UART0_PutChar@plt>
or     $0x30,%bl
movzbl %bl,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <UART0_PutChar@plt>

LLVM IR (-O0):
define void @UART0_SendData8(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %2
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = sdiv i32 %7, 100
store i32 %8, i32* %3
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = srem i32 %10, 100
%12 = sdiv i32 %11, 10
store i32 %12, i32* %4
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = srem i32 %14, 10
store i32 %15, i32* %5
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 48
%18 = call i32 @UART0_PutChar(i32 %17)
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 48
%21 = call i32 @UART0_PutChar(i32 %20)
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 48
%24 = call i32 @UART0_PutChar(i32 %23)
ret void
}

LLVM IR (-O2):
define void @UART0_SendData8(i8 zeroext %0) {
%2 = udiv i8 %0, 100
%3 = urem i8 %0, 100
%4 = udiv i8 %3, 10
%5 = urem i8 %0, 10
%6 = or i8 %2, 48
%7 = zext i8 %6 to i32
%8 = tail call i32 @UART0_PutChar(i32 %7)
%9 = or i8 %4, 48
%10 = zext i8 %9 to i32
%11 = tail call i32 @UART0_PutChar(i32 %10)
%12 = or i8 %5, 48
%13 = zext i8 %12 to i32
%14 = tail call i32 @UART0_PutChar(i32 %13)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ swi_enable();
void sha204p_init(void) { swi_enable(); }


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

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

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

LLVM IR (-O2):
define void @sha204p_init() {
%1 = tail call i32 (...) @swi_enable()
ret void
}
void apu_tick(struct APU *apu) { (void)apu; }


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

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

LLVM IR (-O0):
%struct.APU = type opaque
define void @apu_tick(%struct.APU* %0) {
%2 = alloca %struct.APU*
store %struct.APU* %0, %struct.APU** %2
%3 = load %struct.APU*, %struct.APU** %2
ret void
}

LLVM IR (-O2):
%struct.APU = type opaque
define void @apu_tick(%struct.APU* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
main() {
  int i, a;
  a = 30;
#pragma omp parallel for firstprivate(a) lastprivate(a) num_threads(2)         \
    schedule(static)
  for (i = 0; i < 10; i++)
    a = a + i;
  if (a != 65)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1e,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    114e <main+0x3e>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
cmpl   $0x41,-0xc(%rbp)
je     115f <main+0x4f>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
char *func(int, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) { printf("%s", func(1, 4)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x4,%esi
call   1040 <func@plt>
mov    %rax,%rsi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x4,%esi
call   1040 <func@plt>
lea    0xec9(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = tail call i8* @func(i32 1, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
int clz(int x) {
  for (int i = 31; i >= 0; --i) {
    if ((1 << i) & x) {
      return 31 - i;
    }
  }
  return 32;
}


x86 assembly (clang, -O0):
<clz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1f,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1151 <clz+0x51>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
and    -0x8(%rbp),%eax
cmp    $0x0,%eax
je     113e <clz+0x3e>
mov    $0x1f,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <clz+0x58>
jmp    1143 <clz+0x43>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <clz+0xe>
movl   $0x20,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clz>:
mov    $0x1c,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x3(%rcx),%eax
movzbl %al,%eax
bt     %eax,%edi
jb     1144 <clz+0x44>
lea    0x2(%rcx),%eax
movzbl %al,%eax
bt     %eax,%edi
jb     1149 <clz+0x49>
lea    0x1(%rcx),%eax
movzbl %al,%eax
bt     %eax,%edi
jb     114e <clz+0x4e>
bt     %ecx,%edi
jb     1151 <clz+0x51>
add    $0xfffffffc,%ecx
cmp    $0xfffffffc,%ecx
jne    1110 <clz+0x10>
mov    $0x20,%eax
ret
add    $0x3,%ecx
jmp    1151 <clz+0x51>
add    $0x2,%ecx
jmp    1151 <clz+0x51>
add    $0x1,%ecx
mov    $0x1f,%eax
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @clz(i32 %0) {
br label %2
2: ; preds = %25, %1
%3 = phi i32 [ 31, %1 ], [ %26, %25 ]
%4 = shl nuw i32 1, %3
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %20, %15, %10, %2
%8 = phi i32 [ %3, %2 ], [ %11, %10 ], [ %16, %15 ], [ %21, %20 ]
%9 = sub nsw i32 31, %8
br label %28
10: ; preds = %2
%11 = add nsw i32 %3, -1
%12 = shl nuw i32 1, %11
%13 = and i32 %12, %0
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %7
15: ; preds = %10
%16 = add nsw i32 %3, -2
%17 = shl nuw i32 1, %16
%18 = and i32 %17, %0
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %7
20: ; preds = %15
%21 = add nsw i32 %3, -3
%22 = shl nuw i32 1, %21
%23 = and i32 %22, %0
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %7
25: ; preds = %20
%26 = add nsw i32 %3, -4
%27 = icmp eq i32 %21, 0
br i1 %27, label %28, label %2
28: ; preds = %25, %7
%29 = phi i32 [ %9, %7 ], [ 32, %25 ]
ret i32 %29
}
void genericmultifunction(int other, unsigned char *bufptr, int messleng,
                          int command) {
  other = other;
  bufptr = bufptr;
  messleng = messleng;
  command = command;
}


x86 assembly (clang, -O0):
<genericmultifunction>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @genericmultifunction(i32 %0, i8* nocapture %1, i32 %2, i32 %3) {
ret void
}