xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, ...);
double sqrt(double);
int main() {
  double x = 48;
  double y;
  y = sqrt(x);
  printf("Message "
         "1"
         ": "
         "X = %g\n",
         x);
  printf("Message "
         "2"
         ": "
         "x = %.2f, y = %.4f\n",
         x, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xeb1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xeac(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
movsd  0xee0(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
movsd  0xed2(%rip),%xmm1
movsd  0xec2(%rip),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Message 1: X = %g\0A\00"
@.str.1 = [31 x i8] c"Message 2: x = %.2f, y = %.4f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
store double 4.800000e+01, double* %2
%4 = load double, double* %2
%5 = call double @sqrt(double %4)
store double %5, double* %3
%6 = load double, double* %2
%7 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double %6)
%8 = load double, double* %2
%9 = load double, double* %3
%10 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double %8, double %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Message 1: X = %g\0A\00"
@.str.1 = [31 x i8] c"Message 2: x = %.2f, y = %.4f\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double 4.800000e+01)
%2 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), double 4.800000e+01, double 0x401BB67AE8584CAA)
ret i32 0
}
int any(char c, const char *s) {
  register char d;
  while (d = *s++) {
    if (d == c) {
      return ((-1));
      ;
    };
  }
  return (0);
}


x86 assembly (clang, -O0):
<any>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
cmp    $0x0,%al
je     114b <any+0x4b>
movsbl -0x11(%rbp),%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jne    1146 <any+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    1152 <any+0x52>
jmp    110e <any+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<any>:
movzbl (%rsi),%eax
test   %al,%al
je     1116 <any+0x16>
add    $0x1,%rsi
cmp    %dil,%al
jne    1100 <any>
mov    $0xffffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @any(i8 signext %0, i8* nocapture %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %1, %2 ], [ %8, %7 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = icmp eq i8 %5, %0
br i1 %9, label %10, label %3
10: ; preds = %3, %7
%11 = phi i32 [ -1, %7 ], [ 0, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ noInterrupts();
__attribute__((__always___)) void _noStepIRQ() { noInterrupts(); }


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

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

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

LLVM IR (-O2):
define void @_noStepIRQ() {
%1 = tail call i32 (...) @noInterrupts()
ret void
}
int test_imm_7Cuint16_reg(unsigned short val) {
  return ((val) & (-0x7C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_7Cuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff84,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_7Cuint16_reg>:
test   $0xff84,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_7Cuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -124
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void label_printInt(void *e) {
  int *i = e;
  printf("%i", *i);
}


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

x86 assembly (clang, -O2):
<label_printInt>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define void @label_printInt(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int renameat2(int /*<<< orphan*/, char *, int /*<<< orphan*/, char *,
              int /*<<< orphan*/);
int main(void) {
  int ret;
  ret = renameat2(AT_FDCWD, "test-old-file", AT_FDCWD, "test-new-file", 0);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
lea    0xec8(%rip),%rsi
lea    0xecf(%rip),%rcx
xor    %r8d,%r8d
call   1030 <renameat2@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
lea    0xee7(%rip),%rcx
mov    %edi,%edx
xor    %r8d,%r8d
jmp    1030 <renameat2@plt>

LLVM IR (-O0):
@AT_FDCWD = global i32 0
@.str = [14 x i8] c"test-old-file\00"
@.str.1 = [14 x i8] c"test-new-file\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @AT_FDCWD
%4 = load i32, i32* @AT_FDCWD
%5 = call i32 @renameat2(i32 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 0)
store i32 %5, i32* %2
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@AT_FDCWD = global i32 0
@.str = [14 x i8] c"test-old-file\00"
@.str.1 = [14 x i8] c"test-new-file\00"
define i32 @main() {
%1 = load i32, i32* @AT_FDCWD
%2 = tail call i32 @renameat2(i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ api_putchar(char);
void HariMain(void) { api_putchar('A'); }


x86 assembly (clang, -O0):
<HariMain>:
push   %rbp
mov    %rsp,%rbp
mov    $0x41,%edi
call   1030 <api_putchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HariMain>:
mov    $0x41,%edi
jmp    1030 <api_putchar@plt>

LLVM IR (-O0):
define void @HariMain() {
%1 = call i32 @api_putchar(i8 signext 65)
ret void
}

LLVM IR (-O2):
define void @HariMain() {
%1 = tail call i32 @api_putchar(i8 signext 65)
ret void
}
/* Variables and functions */
#define SIGCHLD 128
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void jrnld_parent_signal_handler(int sig) {
  switch (sig) {
  case SIGCHLD:
    printf("Jrnld crashed\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<jrnld_parent_signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x80,%eax
jne    1154 <jrnld_parent_signal_handler+0x34>
jmp    113e <jrnld_parent_signal_handler+0x1e>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jrnld_parent_signal_handler>:
cmp    $0x80,%edi
je     1129 <jrnld_parent_signal_handler+0x9>
ret
push   %rax
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Jrnld crashed\0A\00"
define void @jrnld_parent_signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %7 [
i32 128, label %4
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"Jrnld crashed\00"
define void @jrnld_parent_signal_handler(i32 %0) {
%2 = icmp eq i32 %0, 128
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("foo and such\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%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 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"foo and such\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"foo and such\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ ffi_cif;

/* Variables and functions */
void closure_test_fn(ffi_cif *cif, void *resp, void **args, void *userdata) {
  *(int *)resp =
      *(int *)args[0] + (int)(*(float *)args[1]) + (int)(long)userdata;
}


x86 assembly (clang, -O0):
<closure_test_fn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
cvttss2si (%rax),%eax
add    %eax,%ecx
mov    -0x20(%rbp),%rax
add    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<closure_test_fn>:
mov    (%rdx),%rax
mov    0x8(%rdx),%rdx
cvttss2si (%rdx),%edx
add    (%rax),%ecx
add    %edx,%ecx
mov    %ecx,(%rsi)
ret

LLVM IR (-O0):
define void @closure_test_fn(i32* %0, i8* %1, i8** %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i8*
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8** %2, i8*** %7
store i8* %3, i8** %8
%9 = load i8**, i8*** %7
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
%14 = load i8**, i8*** %7
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = bitcast i8* %16 to float*
%18 = load float, float* %17
%19 = fptosi float %18 to i32
%20 = add nsw i32 %13, %19
%21 = load i8*, i8** %8
%22 = ptrtoint i8* %21 to i64
%23 = trunc i64 %22 to i32
%24 = add nsw i32 %20, %23
%25 = load i8*, i8** %6
%26 = bitcast i8* %25 to i32*
store i32 %24, i32* %26
ret void
}

LLVM IR (-O2):
define void @closure_test_fn(i32* nocapture readnone %0, i8* nocapture writeonly %1, i8** nocapture %2, i8* %3) {
%5 = bitcast i8** %2 to i32**
%6 = load i32*, i32** %5
%7 = load i32, i32* %6
%8 = getelementptr inbounds i8*, i8** %2, i64 1
%9 = bitcast i8** %8 to float**
%10 = load float*, float** %9
%11 = load float, float* %10
%12 = fptosi float %11 to i32
%13 = ptrtoint i8* %3 to i64
%14 = trunc i64 %13 to i32
%15 = add i32 %7, %14
%16 = add i32 %15, %12
%17 = bitcast i8* %1 to i32*
store i32 %16, i32* %17
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CloseTypeFile();
int /*<<< orphan*/ WriteIniFile(char *);
void CloseWriteFile(char *filNam) {
  WriteIniFile(filNam);
  CloseTypeFile();
}


x86 assembly (clang, -O0):
<CloseWriteFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <WriteIniFile@plt>
mov    $0x0,%al
call   1040 <CloseTypeFile@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CloseWriteFile>:
push   %rax
call   1030 <WriteIniFile@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <CloseTypeFile@plt>

LLVM IR (-O0):
define void @CloseWriteFile(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @WriteIniFile(i8* %3)
%5 = call i32 (...) @CloseTypeFile()
ret void
}

LLVM IR (-O2):
define void @CloseWriteFile(i8* %0) {
%2 = tail call i32 @WriteIniFile(i8* %0)
%3 = tail call i32 (...) @CloseTypeFile()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a = 5;
  int i = 1;
  for (;;) {
    scanf("%d", &a);
    printf("%d\n\n\n", a);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x5,0xc(%rsp)
lea    0xec8(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xebf(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1150 <main+0x30>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 5, i32* %1
br label %3
3: ; preds = %3, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %5)
br label %3
}
/* Type definitions */
typedef int u_short;
typedef int u_char;

/* Variables and functions */
int putshort(u_short s, u_char *msgp) {
  msgp[1] = s;
  msgp[0] = s >> 8;
}


x86 assembly (clang, -O0):
<putshort>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<putshort>:
mov    %edi,0x4(%rsi)
sar    $0x8,%edi
mov    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define i32 @putshort(i32 %0, i32* nocapture writeonly %1) {
%3 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %0, i32* %3
%4 = ashr i32 %0, 8
store i32 %4, i32* %1
ret i32 undef
}
void RTAvlroGCPhysGetBestFit(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlroGCPhysGetBestFit() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ GLdouble;

/* Variables and functions */
int /*<<< orphan*/ glVertex4d(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
void Vertex4d(GLdouble a, GLdouble b, GLdouble c, GLdouble d) {
  glVertex4d(a, b, c, d);
}


x86 assembly (clang, -O0):
<Vertex4d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <glVertex4d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Vertex4d>:
jmp    1030 <glVertex4d@plt>

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

LLVM IR (-O2):
define void @Vertex4d(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @glVertex4d(i32 %0, i32 %1, i32 %2, i32 %3)
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ read_uint32(char const *);
const char *bson_value_to_string(const void *valuePtr, uint8_t *len) {
  const char *valueBytes = (const char *)valuePtr;
  uint32_t stringLen = read_uint32(valueBytes);
  if (len) {
    *len = stringLen - 1;
  }
  return valueBytes + 4;
}


x86 assembly (clang, -O0):
<bson_value_to_string>:
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    -0x18(%rbp),%rdi
call   1030 <read_uint32@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114f <bson_value_to_string+0x3f>
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bson_value_to_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <read_uint32@plt>
test   %r14,%r14
je     112b <bson_value_to_string+0x1b>
add    $0xffffffffffffffff,%rax
mov    %rax,(%r14)
add    $0x4,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @bson_value_to_string(i8* %0, i64* writeonly %1) {
%3 = tail call i64 @read_uint32(i8* %0)
%4 = icmp eq i64* %1, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = add nsw i64 %3, -1
store i64 %6, i64* %1
br label %7
7: ; preds = %5, %2
%8 = getelementptr inbounds i8, i8* %0, i64 4
ret i8* %8
}
void foo385(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo385(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
unsigned base_for_specifier(char spec) {
  switch (spec) {
  case 'i':
  case 'd':
  case 'u':
    return 10;
  case 'b':
    return 2;
  case 'o':
    return 8;
  case 'x':
  case 'X':
    return 16;
  default:
    abort();
    return 0;
  }
}


x86 assembly (clang, -O0):
<base_for_specifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffa8,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x20,%eax
ja     1178 <base_for_specifier+0x68>
mov    -0x10(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xa,-0x4(%rbp)
jmp    117f <base_for_specifier+0x6f>
movl   $0x2,-0x4(%rbp)
jmp    117f <base_for_specifier+0x6f>
movl   $0x8,-0x4(%rbp)
jmp    117f <base_for_specifier+0x6f>
movl   $0x10,-0x4(%rbp)
jmp    117f <base_for_specifier+0x6f>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base_for_specifier>:
push   %rax
add    $0xffffffa8,%edi
cmp    $0x20,%edi
ja     1145 <base_for_specifier+0x35>
mov    $0xa,%eax
lea    0xedb(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
pop    %rcx
ret
mov    $0x10,%eax
pop    %rcx
ret
mov    $0x2,%eax
pop    %rcx
ret
mov    $0x8,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @base_for_specifier(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %10 [
i32 105, label %6
i32 100, label %6
i32 117, label %6
i32 98, label %7
i32 111, label %8
i32 120, label %9
i32 88, label %9
]
6: ; preds = %1, %1, %1
store i32 10, i32* %2
br label %12
7: ; preds = %1
store i32 2, i32* %2
br label %12
8: ; preds = %1
store i32 8, i32* %2
br label %12
9: ; preds = %1, %1
store i32 16, i32* %2
br label %12
10: ; preds = %1
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %9, %8, %7, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @base_for_specifier(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %6 [
i32 105, label %8
i32 100, label %8
i32 117, label %8
i32 98, label %3
i32 111, label %4
i32 120, label %5
i32 88, label %5
]
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1, %1
br label %8
6: ; preds = %1
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1, %1, %1, %5, %4, %3
%9 = phi i32 [ 16, %5 ], [ 8, %4 ], [ 2, %3 ], [ 10, %1 ], [ 10, %1 ], [ 10, %1 ]
ret i32 %9
}
_Noreturn void c() { d1("hi %s"); }


x86 assembly (clang, -O0):
<c>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <d1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<c>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <d1@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"hi %s\00"
define void @c() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @d1 to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
int lib_count_digits_in(double x) {
  int result = 0;
  long long n = x;
  do {
    ++result;
    n /= 10;
  } while (n > 0);
  return result;
}


x86 assembly (clang, -O0):
<lib_count_digits_in>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cvttsd2si -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jg     111a <lib_count_digits_in+0x1a>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib_count_digits_in>:
cvttsd2si %xmm0,%rsi
xor    %ecx,%ecx
movabs $0x6666666666666667,%rdi
66 66 66
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ecx
mov    %rsi,%rax
imul   %rdi
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
cmp    $0x9,%rsi
mov    %rdx,%rsi
jg     1120 <lib_count_digits_in+0x20>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @lib_count_digits_in(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i64
store double %0, double* %2
store i32 0, i32* %3
%5 = load double, double* %2
%6 = fptosi double %5 to i64
store i64 %6, i64* %4
br label %7
7: ; preds = %12, %1
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
%10 = load i64, i64* %4
%11 = sdiv i64 %10, 10
store i64 %11, i64* %4
br label %12
12: ; preds = %7
%13 = load i64, i64* %4
%14 = icmp sgt i64 %13, 0
br i1 %14, label %7, label %15
15: ; preds = %12
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @lib_count_digits_in(double %0) {
%2 = fptosi double %0 to i64
br label %3
3: ; preds = %3, %1
%4 = phi i32 [ 0, %1 ], [ %6, %3 ]
%5 = phi i64 [ %2, %1 ], [ %7, %3 ]
%6 = add nuw nsw i32 %4, 1
%7 = sdiv i64 %5, 10
%8 = icmp sgt i64 %5, 9
br i1 %8, label %3, label %9
9: ; preds = %3
ret i32 %6
}
void module_MODULE_init(void) {}


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

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

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

LLVM IR (-O2):
define void @module_MODULE_init() {
ret void
}
int test_imm_C8uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xC8 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_C8uint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 200
%7 = icmp ne i64 %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_C8uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 858993459200
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int invert(int, int, int);
int /*<<< orphan*/ printbits(int);
int /*<<< orphan*/ putchar(char);
int main(void) {
  printbits(0xA5A5);
  (void)putchar('\n');
  printbits(invert(0xA5A5, 7, 5));
  (void)putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa5a5,%edi
call   1050 <printbits@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa5a5,%edi
mov    $0x7,%esi
mov    $0x5,%edx
call   1040 <invert@plt>
mov    %eax,%edi
call   1050 <printbits@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa5a5,%edi
call   1050 <printbits@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa5a5,%edi
mov    $0x7,%esi
mov    $0x5,%edx
call   1040 <invert@plt>
mov    %eax,%edi
call   1050 <printbits@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printbits(i32 42405)
%3 = call i32 @putchar(i8 signext 10)
%4 = call i32 @invert(i32 42405, i32 7, i32 5)
%5 = call i32 @printbits(i32 %4)
%6 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @printbits(i32 42405)
%2 = tail call i32 @putchar(i8 signext 10)
%3 = tail call i32 @invert(i32 42405, i32 7, i32 5)
%4 = tail call i32 @printbits(i32 %3)
%5 = tail call i32 @putchar(i8 signext 10)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ logwarn(char *, char const *, int /*<<< orphan*/);
scalar_t__ pthread_mutex_unlock(int /*<<< orphan*/ *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void oml_unlock(pthread_mutex_t *mutexP, const char *mutexName) {
  if (mutexP) {
    if (pthread_mutex_unlock(mutexP)) {
      logwarn("%s: Couldn't unlock mutex (%s)\n", mutexName, strerror(errno));
    }
  }
}


x86 assembly (clang, -O0):
<oml_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118b <oml_unlock+0x5b>
mov    -0x8(%rbp),%rdi
call   1040 <pthread_mutex_unlock@plt>
cmp    $0x0,%rax
je     1186 <oml_unlock+0x56>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
lea    0xe7f(%rip),%rdi
call   1030 <logwarn@plt>
jmp    118b <oml_unlock+0x5b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oml_unlock>:
push   %rbx
test   %rdi,%rdi
je     1163 <oml_unlock+0x33>
mov    %rsi,%rbx
call   1040 <pthread_mutex_unlock@plt>
test   %rax,%rax
je     1163 <oml_unlock+0x33>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <logwarn@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"%s: Couldn't unlock mutex (%s)\0A\00"
@errno = global i32 0
define void @oml_unlock(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 = icmp ne i32* %5, null
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = load i32*, i32** %3
%9 = call i64 @pthread_mutex_unlock(i32* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i32, i32* @errno
%14 = call i32 @strerror(i32 %13)
%15 = call i32 @logwarn(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %14)
br label %16
16: ; preds = %11, %7
br label %17
17: ; preds = %16, %2
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"%s: Couldn't unlock mutex (%s)\0A\00"
@errno = global i32 0
define void @oml_unlock(i32* %0, i8* %1) {
%3 = icmp eq i32* %0, null
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = tail call i64 @pthread_mutex_unlock(i32* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = load i32, i32* @errno
%9 = tail call i32 @strerror(i32 %8)
%10 = tail call i32 @logwarn(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %9)
br label %11
11: ; preds = %4, %7, %2
ret void
}
const char *_Locale_int_curr_symbol(struct _Locale_monetary *__DUMMY_PAR) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct._Locale_monetary = type opaque
define i8* @_Locale_int_curr_symbol(%struct._Locale_monetary* %0) {
%2 = alloca %struct._Locale_monetary*
store %struct._Locale_monetary* %0, %struct._Locale_monetary** %2
ret i8* null
}

LLVM IR (-O2):
%struct._Locale_monetary = type opaque
define noalias i8* @_Locale_int_curr_symbol(%struct._Locale_monetary* nocapture readnone %0) {
ret i8* null
}
int non_ascii_p(char *p) {
  while (*p != '\0') {
    if ((signed char)*p++ < 0)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<non_ascii_p>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1144 <non_ascii_p+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jge    113f <non_ascii_p+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    114b <non_ascii_p+0x4b>
jmp    1108 <non_ascii_p+0x8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<non_ascii_p>:
movzbl (%rdi),%eax
test   %al,%al
je     1115 <non_ascii_p+0x15>
add    $0x1,%rdi
test   %al,%al
jns    1100 <non_ascii_p>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @non_ascii_p(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = icmp slt i8 %4, 0
br i1 %8, label %9, label %2
9: ; preds = %2, %6
%10 = phi i32 [ 1, %6 ], [ 0, %2 ]
ret i32 %10
}
/* Variables and functions */
int foo(double);
int bar(void) { return foo(1.2); }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
movsd  0xee4(%rip),%xmm0
call   1030 <foo@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
movsd  0xee8(%rip),%xmm0
jmp    1030 <foo@plt>

LLVM IR (-O0):
define i32 @bar() {
%1 = call i32 @foo(double 1.200000e+00)
ret i32 %1
}

LLVM IR (-O2):
define i32 @bar() {
%1 = tail call i32 @foo(double 1.200000e+00)
ret i32 %1
}
/* Variables and functions */
void *malloc(size_t);
void *__alloc(void *cc, size_t n) { return malloc(n); }


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

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

LLVM IR (-O0):
define i8* @__alloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = call i8* @malloc(i64 %5)
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @__alloc(i8* nocapture readnone %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
ret i8* %3
}
void dummy_function(void) { int number1 = 1, number2 = 2, number3 = 3; }


x86 assembly (clang, -O0):
<dummy_function>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @dummy_function() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int ehrpwm_read(int /*<<< orphan*/, int);
int ehrpwm_et_read_evt_cnt(uint8_t module, unsigned long *evtcnt) {
  *evtcnt = ehrpwm_read(module, 0x34) & ((1 << 3) | (1 << 2));
  *evtcnt >>= 0x2;
  return 0;
}


x86 assembly (clang, -O0):
<ehrpwm_et_read_evt_cnt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x34,%esi
call   1030 <ehrpwm_read@plt>
and    $0xc,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
shr    $0x2,%rcx
mov    %rcx,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ehrpwm_et_read_evt_cnt>:
push   %rbx
mov    %rsi,%rbx
mov    $0x34,%esi
call   1030 <ehrpwm_read@plt>
shr    $0x2,%eax
and    $0x3,%eax
mov    %rax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ehrpwm_et_read_evt_cnt(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%5 = load i32, i32* %3
%6 = call i32 @ehrpwm_read(i32 %5, i32 52)
%7 = and i32 %6, 12
%8 = sext i32 %7 to i64
%9 = load i64*, i64** %4
store i64 %8, i64* %9
%10 = load i64*, i64** %4
%11 = load i64, i64* %10
%12 = lshr i64 %11, 2
store i64 %12, i64* %10
ret i32 0
}

LLVM IR (-O2):
define i32 @ehrpwm_et_read_evt_cnt(i32 %0, i64* nocapture writeonly %1) {
%3 = tail call i32 @ehrpwm_read(i32 %0, i32 52)
%4 = lshr i32 %3, 2
%5 = and i32 %4, 3
%6 = zext i32 %5 to i64
store i64 %6, i64* %1
ret i32 0
}
float test_truncf(float x) { return __builtin_truncf(x); }


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

x86 assembly (clang, -O2):
<test_truncf>:
jmp    1030 <truncf@plt>

LLVM IR (-O0):
define float @test_truncf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @llvm.trunc.f32(float %3)
ret float %4
}

LLVM IR (-O2):
define float @test_truncf(float %0) {
%2 = tail call float @llvm.trunc.f32(float %0)
ret float %2
}
int my_hash(const void *key) { return *(int *)key % 11; }


x86 assembly (clang, -O0):
<my_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_hash>:
movslq (%rdi),%rax
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @my_hash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = srem i32 %5, 11
ret i32 %6
}

LLVM IR (-O2):
define i32 @my_hash(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = srem i32 %3, 11
ret i32 %4
}
int max4(int x1, int x2, int x3, int x4) {
  int m;
  m = x1;
  if (x2 > m)
    m = x2;
  if (x3 > m)
    m = x3;
  if (x4 > m) {
    return x4;
  } else {
    return m;
  }
}


x86 assembly (clang, -O0):
<max4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1128 <max4+0x28>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    113a <max4+0x3a>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1151 <max4+0x51>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1157 <max4+0x57>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max4>:
mov    %edi,%eax
cmp    %edi,%esi
cmovg  %esi,%eax
cmp    %edx,%eax
cmovl  %edx,%eax
cmp    %ecx,%eax
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @max4(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %1, %0
%6 = select i1 %5, i32 %1, i32 %0
%7 = icmp slt i32 %6, %2
%8 = select i1 %7, i32 %2, i32 %6
%9 = icmp slt i32 %8, %3
%10 = select i1 %9, i32 %3, i32 %8
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t hci_event_command_complete_get_command_opcode(const uint8_t *event) {
  return little_endian_read_16(event, 3);
}


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

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

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

LLVM IR (-O2):
define i32 @hci_event_command_complete_get_command_opcode(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 3)
ret i32 %2
}
void RTAvlrFileOffsetRemove(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlrFileOffsetRemove() {
ret void
}
int getGCD(int value1, int value2) {
  int tmp;
  while (value2) {
    tmp = value2;
    value2 = (int)(value1 % value2);
    value1 = tmp;
  }
  return value1;
}


x86 assembly (clang, -O0):
<getGCD>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <getGCD+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    110a <getGCD+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getGCD>:
mov    %edi,%eax
test   %esi,%esi
je     111d <getGCD+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <getGCD+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @getGCD(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %6, %4 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ echo(char *);
main() {
  echo("GOOD1");
  echo("GOOD2");
  echo("GOOD3");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <echo@plt>
lea    0xedf(%rip),%rdi
call   1030 <echo@plt>
lea    0xed9(%rip),%rdi
call   1030 <echo@plt>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"GOOD1\00"
@.str.1 = [6 x i8] c"GOOD2\00"
@.str.2 = [6 x i8] c"GOOD3\00"
define i32 @main() {
%1 = tail call i32 @echo(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @echo(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @echo(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
int add(int a, int b, int c) { return a + b + c; }


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
lea    (%rdi,%rsi,1),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @add(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 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
ret i32 %5
}
void barrier() { __asm__ volatile("" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @barrier() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}