xunge/DecIR huggingface dataset:
const char *__malidrv_build_info(void) {
  return "malidrv:  API_VERSION=23 REPO_URL=heads/master REVISION=-6ab9fe5 "
         "CHANGED_REVISION=6ab9fe5 CHANGE_DATE=2014-06-24 19:22:19 +0300 "
         "BUILD_DATE=Wed Jun 25 16:30:55 EEST 2014 BUILD=release "
         "TARGET_PLATFORM=meson6pre MALI_PLATFORM= KDIR= "
         "OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP= USING_PROFILING= "
         "USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 "
         "MALI_UPPER_HALF_SCHEDULING=1";
}


x86 assembly (clang, -O0):
<__malidrv_build_info>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__malidrv_build_info>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [375 x i8] c"malidrv: API_VERSION=23 REPO_URL=heads/master REVISION=-6ab9fe5 CHANGED_REVISION=6ab9fe5 CHANGE_DATE=2014-06-24 19:22:19 +0300 BUILD_DATE=Wed Jun 25 16:30:55 EEST 2014 BUILD=release TARGET_PLATFORM=meson6pre MALI_PLATFORM= KDIR= OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP= USING_PROFILING= USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 MALI_UPPER_HALF_SCHEDULING=1\00"
define i8* @__malidrv_build_info() {
ret i8* getelementptr inbounds ([375 x i8], [375 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [375 x i8] c"malidrv: API_VERSION=23 REPO_URL=heads/master REVISION=-6ab9fe5 CHANGED_REVISION=6ab9fe5 CHANGE_DATE=2014-06-24 19:22:19 +0300 BUILD_DATE=Wed Jun 25 16:30:55 EEST 2014 BUILD=release TARGET_PLATFORM=meson6pre MALI_PLATFORM= KDIR= OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP= USING_PROFILING= USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 MALI_UPPER_HALF_SCHEDULING=1\00"
define i8* @__malidrv_build_info() {
ret i8* getelementptr inbounds ([375 x i8], [375 x i8]* @.str, i64 0, i64 0)
}
unsigned long long int packup(unsigned short int x[4]) {
  return (((unsigned long long int)x[3]) << 48) |
         (((unsigned long long int)x[2]) << 32) |
         (((unsigned long int)x[1]) << 16) | x[0];
}


x86 assembly (clang, -O0):
<packup>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl 0x6(%rax),%eax
shl    $0x30,%rax
mov    -0x8(%rbp),%rcx
movzwl 0x4(%rcx),%ecx
shl    $0x20,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
movzwl 0x2(%rcx),%ecx
shl    $0x10,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
movzwl (%rcx),%ecx
or     %rcx,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @packup(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = getelementptr inbounds i16, i16* %3, i64 3
%5 = load i16, i16* %4
%6 = zext i16 %5 to i64
%7 = shl i64 %6, 48
%8 = load i16*, i16** %2
%9 = getelementptr inbounds i16, i16* %8, i64 2
%10 = load i16, i16* %9
%11 = zext i16 %10 to i64
%12 = shl i64 %11, 32
%13 = or i64 %7, %12
%14 = load i16*, i16** %2
%15 = getelementptr inbounds i16, i16* %14, i64 1
%16 = load i16, i16* %15
%17 = zext i16 %16 to i64
%18 = shl i64 %17, 16
%19 = or i64 %13, %18
%20 = load i16*, i16** %2
%21 = getelementptr inbounds i16, i16* %20, i64 0
%22 = load i16, i16* %21
%23 = zext i16 %22 to i64
%24 = or i64 %19, %23
ret i64 %24
}

LLVM IR (-O2):
define i64 @packup(i16* nocapture %0) {
%2 = getelementptr inbounds i16, i16* %0, i64 3
%3 = load i16, i16* %2
%4 = zext i16 %3 to i64
%5 = shl nuw i64 %4, 48
%6 = getelementptr inbounds i16, i16* %0, i64 2
%7 = load i16, i16* %6
%8 = zext i16 %7 to i64
%9 = shl nuw nsw i64 %8, 32
%10 = or i64 %9, %5
%11 = getelementptr inbounds i16, i16* %0, i64 1
%12 = load i16, i16* %11
%13 = zext i16 %12 to i64
%14 = shl nuw nsw i64 %13, 16
%15 = or i64 %10, %14
%16 = load i16, i16* %0
%17 = zext i16 %16 to i64
%18 = or i64 %15, %17
ret i64 %18
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("usage: mkfs.minix <input file> <ninodes> <nblocks> <uid> <gid>\n");
  exit(EXIT_SUCCESS);
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"usage: mkfs.minix <input file> <ninodes> <nblocks> <uid> <gid>\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [63 x i8] c"usage: mkfs.minix <input file> <ninodes> <nblocks> <uid> <gid>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
int crypto_sign_ed25519(unsigned char *, unsigned long long *,
                        unsigned char const *, unsigned long long,
                        unsigned char const *);
int crypto_sign(unsigned char *sm, unsigned long long *smlen_p,
                const unsigned char *m, unsigned long long mlen,
                const unsigned char *sk) {
  return crypto_sign_ed25519(sm, smlen_p, m, mlen, sk);
}


x86 assembly (clang, -O0):
<crypto_sign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <crypto_sign_ed25519@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_sign>:
jmp    1030 <crypto_sign_ed25519@plt>

LLVM IR (-O0):
define i32 @crypto_sign(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i64*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8*
store i8* %0, i8** %6
store i64* %1, i64** %7
store i8* %2, i8** %8
store i64 %3, i64* %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i64*, i64** %7
%13 = load i8*, i8** %8
%14 = load i64, i64* %9
%15 = load i8*, i8** %10
%16 = call i32 @crypto_sign_ed25519(i8* %11, i64* %12, i8* %13, i64 %14, i8* %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @crypto_sign(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4) {
%6 = tail call i32 @crypto_sign_ed25519(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4)
ret i32 %6
}
char *parse(char *fileContents) {
  char *parsed;
  while (*fileContents != '\0') {
    if (*fileContents == '\n') {
    }
    *fileContents++;
  }
  return parsed;
}


x86 assembly (clang, -O0):
<parse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     113e <parse+0x3e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    112d <parse+0x2d>
jmp    112d <parse+0x2d>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <parse+0x8>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define noalias i8* @parse(i8* nocapture %0) {
ret i8* undef
}
_Bool f(float nan) { return nan; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xorps  %xmm1,%xmm1
cmpneqss %xmm0,%xmm1
movd   %xmm1,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define zeroext i1 @f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp une float %3, 0.000000e+00
ret i1 %4
}

LLVM IR (-O2):
define zeroext i1 @f(float %0) {
%2 = fcmp une float %0, 0.000000e+00
ret i1 %2
}
/* Variables and functions */
int /*<<< orphan*/ MixerSettingsHandle();
int /*<<< orphan*/ UAVObjLogging(int /*<<< orphan*/);
void MixerSettingsLogging() { UAVObjLogging(MixerSettingsHandle()); }


x86 assembly (clang, -O0):
<MixerSettingsLogging>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <MixerSettingsHandle@plt>
mov    %eax,%edi
call   1030 <UAVObjLogging@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MixerSettingsLogging>:
push   %rax
xor    %eax,%eax
call   1040 <MixerSettingsHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <UAVObjLogging@plt>

LLVM IR (-O0):
define void @MixerSettingsLogging() {
%1 = call i32 (...) @MixerSettingsHandle()
%2 = call i32 @UAVObjLogging(i32 %1)
ret void
}

LLVM IR (-O2):
define void @MixerSettingsLogging() {
%1 = tail call i32 (...) @MixerSettingsHandle()
%2 = tail call i32 @UAVObjLogging(i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ CallBack3(int, void *, void *, void *);
int /*<<< orphan*/ CheckRunningInMainThread(char *);
int XOPDisplayHelpTopic(const char *title, const char *topicStr, int flags) {
  if (!CheckRunningInMainThread("XOPDisplayHelpTopic"))
    return 978;
  return (int)CallBack3(175, (void *)title, (void *)topicStr, (void *)flags);
}


x86 assembly (clang, -O0):
<XOPDisplayHelpTopic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
lea    0xec6(%rip),%rdi
call   1040 <CheckRunningInMainThread@plt>
cmp    $0x0,%eax
jne    1154 <XOPDisplayHelpTopic+0x34>
movl   $0x3d2,-0x4(%rbp)
jmp    116d <XOPDisplayHelpTopic+0x4d>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
movslq -0x1c(%rbp),%rcx
mov    $0xaf,%edi
call   1030 <CallBack3@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XOPDisplayHelpTopic>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecd(%rip),%rdi
call   1040 <CheckRunningInMainThread@plt>
test   %eax,%eax
je     1151 <XOPDisplayHelpTopic+0x31>
movslq %ebp,%rcx
mov    $0xaf,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <CallBack3@plt>
jmp    1156 <XOPDisplayHelpTopic+0x36>
mov    $0x3d2,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"XOPDisplayHelpTopic\00"
define i32 @XOPDisplayHelpTopic(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = call i32 @CheckRunningInMainThread(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %3
store i32 978, i32* %4
br label %19
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
%17 = call i64 @CallBack3(i32 175, i8* %12, i8* %13, i8* %16)
%18 = trunc i64 %17 to i32
store i32 %18, i32* %4
br label %19
19: ; preds = %11, %10
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
@.str = [20 x i8] c"XOPDisplayHelpTopic\00"
define i32 @XOPDisplayHelpTopic(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @CheckRunningInMainThread(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = sext i32 %2 to i64
%8 = inttoptr i64 %7 to i8*
%9 = tail call i64 @CallBack3(i32 175, i8* %0, i8* %1, i8* %8)
%10 = trunc i64 %9 to i32
br label %11
11: ; preds = %3, %6
%12 = phi i32 [ %10, %6 ], [ 978, %3 ]
ret i32 %12
}
unsigned int increment(unsigned int a, unsigned int delta, unsigned int size) {
  return (a + delta) % size;
}


x86 assembly (clang, -O0):
<increment>:
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
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<increment>:
mov    %edx,%ecx
lea    (%rdi,%rsi,1),%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @increment(i32 %0, i32 %1, i32 %2) {
%4 = add i32 %1, %0
%5 = urem i32 %4, %2
ret i32 %5
}
/* Variables and functions */
double exp(int);
double beta_n(const double V) { return 0.125 * exp((45. - V) / 80.); }


x86 assembly (clang, -O0):
<beta_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeeb(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xeb6(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<beta_n>:
push   %rax
movsd  0xee7(%rip),%xmm1
subsd  %xmm0,%xmm1
divsd  0xee3(%rip),%xmm1
cvttsd2si %xmm1,%edi
call   1030 <exp@plt>
mulsd  0xeda(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @beta_n(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double 4.500000e+01, %3
%5 = fdiv double %4, 8.000000e+01
%6 = fptosi double %5 to i32
%7 = call double @exp(i32 %6)
%8 = fmul double 1.250000e-01, %7
ret double %8
}

LLVM IR (-O2):
define double @beta_n(double %0) {
%2 = fsub double 4.500000e+01, %0
%3 = fdiv double %2, 8.000000e+01
%4 = fptosi double %3 to i32
%5 = tail call double @exp(i32 %4)
%6 = fmul double %5, 1.250000e-01
ret double %6
}
int iceillog2(int v) {
  v--;
  v |= v >> 1;
  v |= v >> 2;
  v |= v >> 4;
  v |= v >> 8;
  v |= v >> 16;
  v++;
  return v;
}


x86 assembly (clang, -O0):
<iceillog2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iceillog2>:
lea    -0x1(%rdi),%eax
mov    %eax,%ecx
sar    %ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x2,%eax
or     %ecx,%eax
mov    %eax,%ecx
sar    $0x4,%ecx
or     %eax,%ecx
mov    %ecx,%edx
sar    $0x8,%edx
or     %ecx,%edx
mov    %edx,%eax
sar    $0x10,%eax
or     %edx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @iceillog2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, -1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 1
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = ashr i32 %9, 2
%11 = load i32, i32* %2
%12 = or i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = ashr i32 %13, 4
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = ashr i32 %17, 8
%19 = load i32, i32* %2
%20 = or i32 %19, %18
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = ashr i32 %21, 16
%23 = load i32, i32* %2
%24 = or i32 %23, %22
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @iceillog2(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = ashr i32 %2, 1
%4 = or i32 %3, %2
%5 = ashr i32 %4, 2
%6 = or i32 %5, %4
%7 = ashr i32 %6, 4
%8 = or i32 %7, %6
%9 = ashr i32 %8, 8
%10 = or i32 %9, %8
%11 = ashr i32 %10, 16
%12 = or i32 %11, %10
%13 = add nsw i32 %12, 1
ret i32 %13
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ basic_test(int);
int /*<<< orphan*/ cleanup_test();
int /*<<< orphan*/ init_test();
int log_read_middle(int);
void read_one_sector_middle(void) {
  ssize_t n;
  init_test();
  n = log_read_middle(512);
  basic_test(n == 512);
  cleanup_test();
}


x86 assembly (clang, -O0):
<read_one_sector_middle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <init_test@plt>
mov    $0x200,%edi
call   1040 <log_read_middle@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x200,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <basic_test@plt>
mov    $0x0,%al
call   1050 <cleanup_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_one_sector_middle>:
push   %rax
xor    %eax,%eax
call   1060 <init_test@plt>
mov    $0x200,%edi
call   1040 <log_read_middle@plt>
xor    %edi,%edi
cmp    $0x200,%eax
sete   %dil
call   1030 <basic_test@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <cleanup_test@plt>

LLVM IR (-O0):
define void @read_one_sector_middle() {
%1 = alloca i32
%2 = call i32 (...) @init_test()
%3 = call i32 @log_read_middle(i32 512)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 512
%6 = zext i1 %5 to i32
%7 = call i32 @basic_test(i32 %6)
%8 = call i32 (...) @cleanup_test()
ret void
}

LLVM IR (-O2):
define void @read_one_sector_middle() {
%1 = tail call i32 (...) @init_test()
%2 = tail call i32 @log_read_middle(i32 512)
%3 = icmp eq i32 %2, 512
%4 = zext i1 %3 to i32
%5 = tail call i32 @basic_test(i32 %4)
%6 = tail call i32 (...) @cleanup_test()
ret void
}
int popcount(unsigned long long x) { return __builtin_popcountll(x); }


x86 assembly (clang, -O0):
<popcount>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    %rcx,%rax
shr    %rax
movabs $0x5555555555555555,%rdx
55 55 55
and    %rdx,%rax
sub    %rax,%rcx
movabs $0x3333333333333333,%rdx
33 33 33
mov    %rcx,%rax
and    %rdx,%rax
shr    $0x2,%rcx
and    %rdx,%rcx
add    %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
add    %rcx,%rax
movabs $0xf0f0f0f0f0f0f0f,%rcx
0f 0f 0f
and    %rcx,%rax
movabs $0x101010101010101,%rcx
01 01 01
imul   %rcx,%rax
shr    $0x38,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<popcount>:
mov    %rdi,%rax
shr    %rax
movabs $0x5555555555555555,%rcx
55 55 55
and    %rax,%rcx
sub    %rcx,%rdi
movabs $0x3333333333333333,%rax
33 33 33
mov    %rdi,%rcx
and    %rax,%rcx
shr    $0x2,%rdi
and    %rdi,%rax
add    %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
add    %rax,%rcx
movabs $0xf0f0f0f0f0f0f0f,%rdx
0f 0f 0f
and    %rcx,%rdx
movabs $0x101010101010101,%rax
01 01 01
imul   %rdx,%rax
shr    $0x38,%rax
ret

LLVM IR (-O0):
define i32 @popcount(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @llvm.ctpop.i64(i64 %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @popcount(i64 %0) {
%2 = tail call i64 @llvm.ctpop.i64(i64 %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int lengthOfLongestSubstring(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char *s = "au";
  int answer = lengthOfLongestSubstring(s);
  printf("answer = %d\n", answer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <lengthOfLongestSubstring@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <lengthOfLongestSubstring@plt>
lea    0xecf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"au\00"
@.str.1 = [13 x i8] c"answer = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @lengthOfLongestSubstring(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int ft_is_prime(int);
int ft_find_next_prime(int nb) {
  while (ft_is_prime(nb) != 1) {
    nb++;
  }
  return (nb);
}


x86 assembly (clang, -O0):
<ft_find_next_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <ft_is_prime@plt>
cmp    $0x1,%eax
je     113a <ft_find_next_prime+0x2a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111b <ft_find_next_prime+0xb>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_find_next_prime>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <ft_is_prime@plt>
add    $0x1,%ebx
cmp    $0x1,%eax
jne    1120 <ft_find_next_prime+0x10>
add    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ft_find_next_prime(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %6, %2 ]
%4 = tail call i32 @ft_is_prime(i32 %3)
%5 = icmp eq i32 %4, 1
%6 = add nsw i32 %3, 1
br i1 %5, label %7, label %2
7: ; preds = %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ runTestShiftArithmetic();
int main(int argc, const char *argv[]) {
  printf("Bitwise Operations\n");
  printf("Logical Shift Operations\n");
  printf("Arithmetic Shift Operations\n");
  runTestShiftArithmetic();
  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    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <runTestShiftArithmetic@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <runTestShiftArithmetic@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Bitwise Operations\0A\00"
@.str.1 = [26 x i8] c"Logical Shift Operations\0A\00"
@.str.2 = [29 x i8] c"Arithmetic Shift Operations\0A\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 ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (...) @runTestShiftArithmetic()
ret i32 0
}

LLVM IR (-O2):
@str = [19 x i8] c"Bitwise Operations\00"
@str.3 = [25 x i8] c"Logical Shift Operations\00"
@str.4 = [28 x i8] c"Arithmetic Shift Operations\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.4, i64 0, i64 0))
%6 = tail call i32 (...) @runTestShiftArithmetic()
ret i32 0
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_THREAD_CPUTIME_ID;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
double thread_time() {
  struct timespec ts;
  clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
  return (double)ts.tv_sec + (double)ts.tv_nsec / 1000000000.0;
}


x86 assembly (clang, -O0):
<thread_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xec2(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_time>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
divsd  0xec3(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@CLOCK_THREAD_CPUTIME_ID = global i32 0
define double @thread_time() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 1.000000e+09
%11 = fadd double %6, %10
ret double %11
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@CLOCK_THREAD_CPUTIME_ID = global i32 0
define double @thread_time() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = fdiv double %10, 1.000000e+09
%12 = fadd double %11, %7
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M105_f(char *s) {
  debug("M105_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M105_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M105_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M105_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M105_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M105_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M105_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Type definitions */
struct MHD_Connection {
  int dummy;
};

/* Variables and functions */
int ahc_nothing(void *cls, struct MHD_Connection *connection, const char *url,
                const char *method, const char *version,
                const char *upload_data, size_t *upload_data_size,
                void **unused) {
  (void)cls;
  (void)connection;
  (void)url;
  (void)method;
  (void)version;
  (void)upload_data;
  (void)upload_data_size;
  (void)unused;
  return 0;
}


x86 assembly (clang, -O0):
<ahc_nothing>:
push   %rbp
mov    %rsp,%rbp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.MHD_Connection = type { i32 }
define i32 @ahc_nothing(i8* %0, %struct.MHD_Connection* %1, i8* %2, i8* %3, i8* %4, i8* %5, i64* %6, i8** %7) {
%9 = alloca i8*
%10 = alloca %struct.MHD_Connection*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i64*
%16 = alloca i8**
store i8* %0, i8** %9
store %struct.MHD_Connection* %1, %struct.MHD_Connection** %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i8* %4, i8** %13
store i8* %5, i8** %14
store i64* %6, i64** %15
store i8** %7, i8*** %16
%17 = load i8*, i8** %9
%18 = load %struct.MHD_Connection*, %struct.MHD_Connection** %10
%19 = load i8*, i8** %11
%20 = load i8*, i8** %12
%21 = load i8*, i8** %13
%22 = load i8*, i8** %14
%23 = load i64*, i64** %15
%24 = load i8**, i8*** %16
ret i32 0
}

LLVM IR (-O2):
%struct.MHD_Connection = type { i32 }
define i32 @ahc_nothing(i8* nocapture readnone %0, %struct.MHD_Connection* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* nocapture readnone %4, i8* nocapture readnone %5, i64* nocapture readnone %6, i8** nocapture readnone %7) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char);
void display(unsigned char *buffer, int buffer_len) {
  int counter;
  unsigned char data_byte;
  for (counter = 0; counter < buffer_len; counter++) {
    data_byte = buffer[counter];
    printf("\\x%02x", data_byte);
  }
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115e <display+0x4e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
lea    0xeb9(%rip),%rdi
movzbl -0x11(%rbp),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <display+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1146 <display+0x36>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <display+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"\\x%02x\00"
define void @display(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 zeroext %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int sscanf(char const *, char *, int *);
int str_to_int(const char *str) {
  int x;
  if (sscanf(str, "%d", &x) == 1)
    return x;
  else {
    printf("Warning: Not an integer: %s\n", str);
    return -1;
  }
}


x86 assembly (clang, -O0):
<str_to_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    1154 <str_to_int+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116b <str_to_int+0x4b>
mov    -0x10(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_to_int>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xed1(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    1144 <str_to_int+0x24>
mov    0xc(%rsp),%eax
jmp    1158 <str_to_int+0x38>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"Warning: Not an integer: %s\0A\00"
define i32 @str_to_int(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* %4
store i32 %9, i32* %2
br label %13
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %11)
store i32 -1, i32* %2
br label %13
13: ; preds = %10, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"Warning: Not an integer: %s\0A\00"
define i32 @str_to_int(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* %2
br label %10
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %10
10: ; preds = %8, %6
%11 = phi i32 [ %7, %6 ], [ -1, %8 ]
ret i32 %11
}
/* Variables and functions */
int sys_zoomfontheight(int, int, int /*<<< orphan*/);
int sys_fontheight(int fontsize) {
  return (sys_zoomfontheight(fontsize, 1, 0));
}


x86 assembly (clang, -O0):
<sys_fontheight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <sys_zoomfontheight@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_fontheight>:
mov    $0x1,%esi
xor    %edx,%edx
jmp    1030 <sys_zoomfontheight@plt>

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

LLVM IR (-O2):
define i32 @sys_fontheight(i32 %0) {
%2 = tail call i32 @sys_zoomfontheight(i32 %0, i32 1, i32 0)
ret i32 %2
}
/* Variables and functions */
size_t GO_strlen(char *d) {
  char *tmp = d;
  while ('\0' != *d)
    d++;
  return d - tmp;
}


x86 assembly (clang, -O0):
<GO_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     1132 <GO_strlen+0x32>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <GO_strlen+0x10>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GO_strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <GO_strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @GO_strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
/* Type definitions */
struct stat64 {
  int dummy;
};

/* Variables and functions */
int stat64(char *, struct stat64 *);
int fb_lfs_stat(char *path, struct stat64 *statbufp) {
  return (stat64(path, statbufp));
}


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

x86 assembly (clang, -O2):
<fb_lfs_stat>:
jmp    1030 <stat64@plt>

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

LLVM IR (-O2):
%struct.stat64 = type { i32 }
define i32 @fb_lfs_stat(i8* nocapture %0, %struct.stat64* nocapture %1) {
%3 = tail call i32 @stat64(i8* %0, %struct.stat64* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ wctype_t;
typedef int /*<<< orphan*/ locale_t;

/* Variables and functions */
int /*<<< orphan*/ wctype(char const *);
wctype_t __wctype_l(const char *s, locale_t l) { return wctype(s); }


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

x86 assembly (clang, -O2):
<__wctype_l>:
jmp    1030 <wctype@plt>

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

LLVM IR (-O2):
define i32 @__wctype_l(i8* %0, i32 %1) {
%3 = tail call i32 @wctype(i8* %0)
ret i32 %3
}
void rcu_momentary_dyntick_idle(void) {}


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

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

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

LLVM IR (-O2):
define void @rcu_momentary_dyntick_idle() {
ret void
}
void reti_inst(struct state *context, struct debug_state *dbg_context,
               struct instruction *inst) {}


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

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

LLVM IR (-O0):
%struct.state = type opaque
%struct.debug_state = type opaque
%struct.instruction = type opaque
define void @reti_inst(%struct.state* %0, %struct.debug_state* %1, %struct.instruction* %2) {
%4 = alloca %struct.state*
%5 = alloca %struct.debug_state*
%6 = alloca %struct.instruction*
store %struct.state* %0, %struct.state** %4
store %struct.debug_state* %1, %struct.debug_state** %5
store %struct.instruction* %2, %struct.instruction** %6
ret void
}

LLVM IR (-O2):
%struct.state = type opaque
%struct.debug_state = type opaque
%struct.instruction = type opaque
define void @reti_inst(%struct.state* nocapture %0, %struct.debug_state* nocapture %1, %struct.instruction* nocapture %2) {
ret void
}
void func() { int i = 0; }


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @func() {
ret void
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dsmeanors(int, float *, int);
int main() {
  float x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  double v = stdlib_strided_dsmeanors(N, x, stride);
  printf("mean: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x4,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   1040 <stdlib_strided_dsmeanors@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_dsmeanors@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00]
@.str = [11 x i8] c"mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [8 x float]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dsmeanors(i32 %6, float* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00]
@.str = [11 x i8] c"mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = bitcast [8 x float]* %1 to i8*
%3 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dsmeanors(i32 4, float* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
/* Type definitions */
struct histogram {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct histogram *);
void histogram_free(struct histogram *hist) { free(hist); }


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

x86 assembly (clang, -O2):
<histogram_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.histogram = type { i32 }
define void @histogram_free(%struct.histogram* nocapture %0) {
%2 = tail call i32 @free(%struct.histogram* %0)
ret void
}
/* Variables and functions */
scalar_t__ utf8_strlen(char const *);
int dstrvalid(const char *str) { return utf8_strlen(str) >= 0; }


x86 assembly (clang, -O0):
<dstrvalid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <utf8_strlen@plt>
cmp    $0x0,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dstrvalid>:
push   %rax
call   1030 <utf8_strlen@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @dstrvalid(i8* %0) {
%2 = tail call i64 @utf8_strlen(i8* %0)
%3 = lshr i64 %2, 63
%4 = trunc i64 %3 to i32
%5 = xor i32 %4, 1
ret i32 %5
}
void sti(void) { __asm__ volatile("sti"); }


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

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

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

LLVM IR (-O2):
define void @sti() {
tail call void asm sideeffect "sti", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
struct v4lprocessing_data {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct v4lprocessing_data *);
void v4lprocessing_destroy(struct v4lprocessing_data *data) { free(data); }


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

x86 assembly (clang, -O2):
<v4lprocessing_destroy>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.v4lprocessing_data = type { i32 }
define void @v4lprocessing_destroy(%struct.v4lprocessing_data* nocapture %0) {
%2 = tail call i32 @free(%struct.v4lprocessing_data* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __NR_memfd_create;
int syscall(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int main(void) { return syscall(__NR_memfd_create, "testmfd", 0); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
xor    %edx,%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
xor    %edx,%edx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@__NR_memfd_create = global i32 0
@.str = [8 x i8] c"testmfd\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @__NR_memfd_create
%3 = call i32 @syscall(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 %3
}

LLVM IR (-O2):
@__NR_memfd_create = global i32 0
@.str = [8 x i8] c"testmfd\00"
define i32 @main() {
%1 = load i32, i32* @__NR_memfd_create
%2 = tail call i32 @syscall(i32 %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 0)
ret i32 %2
}