xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ VF_SET();
int VF_SET_01() { return VF_SET() ? 1 : 0; }


x86 assembly (clang, -O0):
<VF_SET_01>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <VF_SET@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @VF_SET_01() {
%1 = call i64 (...) @VF_SET()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i64
%4 = select i1 %2, i32 1, i32 0
ret i32 %4
}

LLVM IR (-O2):
define i32 @VF_SET_01() {
%1 = tail call i64 (...) @VF_SET()
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct keyboardDevice {
  int dummy;
};
struct device {
  int dummy;
};

/* Variables and functions */
int compareDevice(struct device *, struct device *);
int keyboardCompareDevice(struct keyboardDevice *dev1,
                          struct keyboardDevice *dev2) {
  return compareDevice((struct device *)dev1, (struct device *)dev2);
}


x86 assembly (clang, -O0):
<keyboardCompareDevice>:
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 <compareDevice@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyboardCompareDevice>:
jmp    1030 <compareDevice@plt>

LLVM IR (-O0):
%struct.keyboardDevice = type { i32 }
%struct.device = type { i32 }
define i32 @keyboardCompareDevice(%struct.keyboardDevice* %0, %struct.keyboardDevice* %1) {
%3 = alloca %struct.keyboardDevice*
%4 = alloca %struct.keyboardDevice*
store %struct.keyboardDevice* %0, %struct.keyboardDevice** %3
store %struct.keyboardDevice* %1, %struct.keyboardDevice** %4
%5 = load %struct.keyboardDevice*, %struct.keyboardDevice** %3
%6 = bitcast %struct.keyboardDevice* %5 to %struct.device*
%7 = load %struct.keyboardDevice*, %struct.keyboardDevice** %4
%8 = bitcast %struct.keyboardDevice* %7 to %struct.device*
%9 = call i32 @compareDevice(%struct.device* %6, %struct.device* %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.keyboardDevice = type { i32 }
%struct.device = type { i32 }
define i32 @keyboardCompareDevice(%struct.keyboardDevice* %0, %struct.keyboardDevice* %1) {
%3 = bitcast %struct.keyboardDevice* %0 to %struct.device*
%4 = bitcast %struct.keyboardDevice* %1 to %struct.device*
%5 = tail call i32 @compareDevice(%struct.device* %3, %struct.device* %4)
ret i32 %5
}
/* Variables and functions */
double bessel(double);
int /*<<< orphan*/ fmax(double, double);
double sqrt(int /*<<< orphan*/);
__attribute__((always_)) double kaiser(double x, double beta) {
  return bessel(beta * sqrt(fmax(0.0, 1.0 - (x * x))));
}


x86 assembly (clang, -O0):
<kaiser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe87(%rip),%xmm0
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <bessel@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kaiser>:
push   %rax
movsd  %xmm1,(%rsp)
mulsd  %xmm0,%xmm0
movsd  0xebe(%rip),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
call   1050 <sqrt@plt>
mulsd  (%rsp),%xmm0
pop    %rax
jmp    1030 <bessel@plt>

LLVM IR (-O0):
define double @kaiser(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = load double, double* %3
%8 = fneg double %6
%9 = call double @llvm.fmuladd.f64(double %8, double %7, double 1.000000e+00)
%10 = call i32 @fmax(double 0.000000e+00, double %9)
%11 = call double @sqrt(i32 %10)
%12 = fmul double %5, %11
%13 = call double @bessel(double %12)
ret double %13
}

LLVM IR (-O2):
define double @kaiser(double %0, double %1) {
%3 = fneg double %0
%4 = tail call double @llvm.fmuladd.f64(double %3, double %0, double 1.000000e+00)
%5 = tail call i32 @fmax(double 0.000000e+00, double %4)
%6 = tail call double @sqrt(i32 %5)
%7 = fmul double %6, %1
%8 = tail call double @bessel(double %7)
ret double %8
}
void av_opt_get_int() {}


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

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

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

LLVM IR (-O2):
define void @av_opt_get_int() {
ret void
}
int test_imm_00uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x00 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
mov    $0xffffffd8,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_00uint64_lowword_reg(i64 %0) {
ret i32 -40
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *gmtime_r(int /*<<< orphan*/ const *, struct tm *);
struct tm *gmtime(const time_t *timer) {
  static struct tm tm;
  return gmtime_r(timer, &tm);
}


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

x86 assembly (clang, -O2):
<gmtime>:
lea    0x2f15(%rip),%rsi
jmp    1030 <gmtime_r@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
@gmtime.tm = internal global %struct.tm zeroinitializer
define %struct.tm* @gmtime(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call %struct.tm* @gmtime_r(i32* %3, %struct.tm* @gmtime.tm)
ret %struct.tm* %4
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@gmtime.tm = internal global %struct.tm zeroinitializer
define %struct.tm* @gmtime(i32* %0) {
%2 = tail call %struct.tm* @gmtime_r(i32* %0, %struct.tm* @gmtime.tm)
ret %struct.tm* %2
}
/* Variables and functions */
int decimal_string_length(int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
void port_to_string(int port, char *port_string) {
  int port_string_length = decimal_string_length(port);
  snprintf(port_string, port_string_length, "%d", port);
}


x86 assembly (clang, -O0):
<port_to_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <decimal_string_length@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x4(%rbp),%ecx
lea    0xeb5(%rip),%rdx
call   1040 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<port_to_string>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <decimal_string_length@plt>
lea    0xecc(%rip),%rdx
mov    %rbx,%rdi
mov    %eax,%esi
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <snprintf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @port_to_string(i32 %0, i8* %1) {
%3 = tail call i32 @decimal_string_length(i32 %0)
%4 = tail call i32 @snprintf(i8* %1, i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f1(char *);
int /*<<< orphan*/ f2(char *);
int /*<<< orphan*/ f3(char *);
void main(void) {
  (void)f1("hullo");
  (void)f2("hullo");
  f3("hullo");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1050 <f1@plt>
lea    0xeb9(%rip),%rdi
call   1030 <f2@plt>
lea    0xead(%rip),%rdi
call   1040 <f3@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
call   1050 <f1@plt>
mov    %rbx,%rdi
call   1030 <f2@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <f3@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"hullo\00"
define void @main() {
%1 = tail call i32 @f1(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @f2(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @f3(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned long USBNumEndpointsGet(unsigned long ulBase) { return (15); }


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

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

LLVM IR (-O0):
define i64 @USBNumEndpointsGet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
ret i64 15
}

LLVM IR (-O2):
define i64 @USBNumEndpointsGet(i64 %0) {
ret i64 15
}
/* Variables and functions */
int /*<<< orphan*/ srandom(long);
void _ran1init(long n) { srandom(n); }


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

x86 assembly (clang, -O2):
<_ran1init>:
jmp    1030 <srandom@plt>

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

LLVM IR (-O2):
define void @_ran1init(i64 %0) {
%2 = tail call i32 @srandom(i64 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PORTE_DriverIRQHandler();
__attribute__((weak)) void PORTE_IRQHandler(void) { PORTE_DriverIRQHandler(); }


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

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

LLVM IR (-O0):
define weak void @PORTE_IRQHandler() {
%1 = call i32 (...) @PORTE_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @PORTE_IRQHandler() {
%1 = tail call i32 (...) @PORTE_DriverIRQHandler()
ret void
}
long addition(long a, long b) {
  long result;
  result = a + b;
  return result;
}


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

x86 assembly (clang, -O2):
<addition>:
lea    (%rdi,%rsi,1),%rax
ret

LLVM IR (-O0):
define i64 @addition(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = add nsw i64 %6, %7
store i64 %8, i64* %5
%9 = load i64, i64* %5
ret i64 %9
}

LLVM IR (-O2):
define i64 @addition(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
void putstring(char *s) {
  while (*s) {
    putchar(*s++);
  }
}


x86 assembly (clang, -O0):
<putstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <putstring+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
jmp    111c <putstring+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putstring>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <putstring+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <putstring+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @putstring(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @putchar(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Type definitions */
struct ifreq {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SIOCGIFHWADDR;
int /*<<< orphan*/ close(int);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ifreq *);
int get_mac(int sock, struct ifreq *ifr) {
  if (ioctl(sock, SIOCGIFHWADDR, ifr) < 0) {
    close(sock);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_mac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ea7(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    1162 <get_mac+0x42>
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <get_mac+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mac>:
push   %rbx
mov    %rsi,%rdx
mov    %edi,%ebx
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
js     1140 <get_mac+0x20>
pop    %rbx
ret
mov    %ebx,%edi
call   1040 <close@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ifreq = type { i32 }
@SIOCGIFHWADDR = global i32 0
define i32 @get_mac(i32 %0, %struct.ifreq* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.ifreq*
store i32 %0, i32* %4
store %struct.ifreq* %1, %struct.ifreq** %5
%6 = load i32, i32* %4
%7 = load i32, i32* @SIOCGIFHWADDR
%8 = load %struct.ifreq*, %struct.ifreq** %5
%9 = call i64 @ioctl(i32 %6, i32 %7, %struct.ifreq* %8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32, i32* %4
%13 = call i32 @close(i32 %12)
store i32 -1, i32* %3
br label %15
14: ; preds = %2
store i32 0, i32* %3
br label %15
15: ; preds = %14, %11
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
%struct.ifreq = type { i32 }
@SIOCGIFHWADDR = global i32 0
define i32 @get_mac(i32 %0, %struct.ifreq* %1) {
%3 = load i32, i32* @SIOCGIFHWADDR
%4 = tail call i64 @ioctl(i32 %0, i32 %3, %struct.ifreq* %1)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @close(i32 %0)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ -1, %6 ], [ 0, %2 ]
ret i32 %9
}
int test_imm_64uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x64 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_64uint64_midword_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, 16
%6 = and i64 %5, 100
%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_64uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 6553600
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int pow(float, double);
int calc(float a, float b) {
  float z;
  z = (2 * pow(a, 3.0) + 3 * pow(b, 3.0)) / (3 * pow(a, 2.0) - 2 * pow(b, 2.0));
  return 0;
}


x86 assembly (clang, -O0):
<calc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  0xed9(%rip),%xmm1
call   1030 <pow@plt>
shl    $0x1,%eax
mov    %eax,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movsd  0xec1(%rip),%xmm1
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
imul   $0x3,%ecx,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  0xe9a(%rip),%xmm1
call   1030 <pow@plt>
imul   $0x3,%eax,%eax
mov    %eax,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movsd  0xe82(%rip),%xmm1
call   1030 <pow@plt>
mov    -0x14(%rbp),%ecx
mov    %eax,%edx
mov    -0x10(%rbp),%eax
shl    $0x1,%edx
sub    %edx,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc>:
push   %rax
movss  %xmm1,(%rsp)
movss  %xmm0,0x4(%rsp)
movsd  0xedc(%rip),%xmm1
call   1030 <pow@plt>
movss  (%rsp),%xmm0
movsd  0xeca(%rip),%xmm1
call   1030 <pow@plt>
movsd  0xec5(%rip),%xmm1
movss  0x4(%rsp),%xmm0
call   1030 <pow@plt>
movss  (%rsp),%xmm0
movsd  0xead(%rip),%xmm1
call   1030 <pow@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @calc(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = call i32 @pow(float %6, double 3.000000e+00)
%8 = mul nsw i32 2, %7
%9 = load float, float* %4
%10 = call i32 @pow(float %9, double 3.000000e+00)
%11 = mul nsw i32 3, %10
%12 = add nsw i32 %8, %11
%13 = load float, float* %3
%14 = call i32 @pow(float %13, double 2.000000e+00)
%15 = mul nsw i32 3, %14
%16 = load float, float* %4
%17 = call i32 @pow(float %16, double 2.000000e+00)
%18 = mul nsw i32 2, %17
%19 = sub nsw i32 %15, %18
%20 = sdiv i32 %12, %19
%21 = sitofp i32 %20 to float
store float %21, float* %5
ret i32 0
}

LLVM IR (-O2):
define i32 @calc(float %0, float %1) {
%3 = tail call i32 @pow(float %0, double 3.000000e+00)
%4 = tail call i32 @pow(float %1, double 3.000000e+00)
%5 = tail call i32 @pow(float %0, double 2.000000e+00)
%6 = tail call i32 @pow(float %1, double 2.000000e+00)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t bytes_r32le(const uint8_t *data) {
  return ((uint32_t)data[0]) | (((uint32_t)data[1]) << 8) |
         (((uint32_t)data[2]) << 16) | (((uint32_t)data[3]) << 24);
}


x86 assembly (clang, -O0):
<bytes_r32le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x18(%rcx),%rcx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytes_r32le>:
mov    0x8(%rdi),%ecx
mov    0x10(%rdi),%edx
shl    $0x8,%ecx
or     (%rdi),%ecx
shl    $0x10,%edx
mov    0x18(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @bytes_r32le(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = getelementptr inbounds i64, i64* %0, i64 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i64, i64* %0, i64 2
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = shl i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i64, i64* %0, i64 3
%15 = load i64, i64* %14
%16 = trunc i64 %15 to i32
%17 = shl i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
/* Variables and functions */
char *stpcpy_x86_64_fast(char *, char const *);
char *stpcpy(char *__restrict__ dest, const char *__restrict__ src) {
  return stpcpy_x86_64_fast(dest, src);
}


x86 assembly (clang, -O0):
<stpcpy>:
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 <stpcpy_x86_64_fast@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stpcpy>:
jmp    1030 <stpcpy_x86_64_fast@plt>

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

LLVM IR (-O2):
define i8* @stpcpy(i8* noalias %0, i8* noalias %1) {
%3 = tail call i8* @stpcpy_x86_64_fast(i8* %0, i8* %1)
ret i8* %3
}
void foof() {}


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

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

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

LLVM IR (-O2):
define void @foof() {
ret void
}
unsigned int ar_mbox_status_get(int my_cid) {}


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

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

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

LLVM IR (-O2):
define i32 @ar_mbox_status_get(i32 %0) {
ret i32 undef
}
int getSize(void *mem) {
  int *p = mem;
  return p[(0)];
}


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

x86 assembly (clang, -O2):
<getSize>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @getSize(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 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @getSize(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
long random();
int skiprand(int seed, int n) {
  long tmp;
  {
    {
      while (1) {
      while_9_continue:;
        if (n) {
        } else {
          goto while_9_break;
        }
        {
          tmp = random();
          seed = (int)tmp;
          n = n - 1;
        }
      }
    while_9_break:;
    }
    return (seed);
  }
}


x86 assembly (clang, -O0):
<skiprand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
jmp    1123 <skiprand+0x13>
cmpl   $0x0,-0x8(%rbp)
je     1132 <skiprand+0x22>
jmp    1137 <skiprand+0x27>
jmp    1157 <skiprand+0x47>
mov    $0x0,%al
call   1030 <random@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111e <skiprand+0xe>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skiprand>:
mov    %edi,%eax
test   %esi,%esi
je     112d <skiprand+0x1d>
push   %rbx
mov    %esi,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <random@plt>
add    $0xffffffff,%ebx
jne    1120 <skiprand+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @skiprand(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = tail call i64 (...) @random()
%7 = add nsw i32 %5, -1
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = trunc i64 %6 to i32
br label %11
11: ; preds = %9, %2
%12 = phi i32 [ %10, %9 ], [ %0, %2 ]
ret i32 %12
}
void power_supply_init_attrs(struct device_type *dev_type) {}


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

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

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

LLVM IR (-O2):
%struct.device_type = type opaque
define void @power_supply_init_attrs(%struct.device_type* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ unimplemented();
void norm_reg(void) { unimplemented(); }


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

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

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

LLVM IR (-O2):
define void @norm_reg() {
%1 = tail call i32 (...) @unimplemented()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vtc_set_mac_margin(double);
void(mr1calccoulomb_set_tree_margin__)(double *margin) {
  vtc_set_mac_margin(*margin);
}


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

x86 assembly (clang, -O2):
<mr1calccoulomb_set_tree_margin__>:
movsd  (%rdi),%xmm0
jmp    1030 <vtc_set_mac_margin@plt>

LLVM IR (-O0):
define void @mr1calccoulomb_set_tree_margin__(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = load double, double* %3
%5 = call i32 @vtc_set_mac_margin(double %4)
ret void
}

LLVM IR (-O2):
define void @mr1calccoulomb_set_tree_margin__(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call i32 @vtc_set_mac_margin(double %2)
ret void
}
unsigned int next_power(unsigned int size) {
  unsigned int i = 256;
  if (size >= 2147483648U)
    return 2147483648U;
  while (1) {
    if (i >= size)
      return i;
    i *= 2;
  }
}


x86 assembly (clang, -O0):
<next_power>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x100,-0xc(%rbp)
cmpl   $0x80000000,-0x8(%rbp)
jb     1127 <next_power+0x27>
movl   $0x80000000,-0x4(%rbp)
jmp    1151 <next_power+0x51>
jmp    112c <next_power+0x2c>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jb     1143 <next_power+0x43>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <next_power+0x51>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112c <next_power+0x2c>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_power>:
test   %edi,%edi
js     111a <next_power+0x1a>
mov    $0x100,%ecx
nopl   0x0(%rax)
mov    %ecx,%eax
lea    (%rax,%rax,1),%ecx
cmp    %edi,%eax
jb     1110 <next_power+0x10>
ret
mov    $0x80000000,%eax
ret

LLVM IR (-O0):
define i32 @next_power(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 256, i32* %4
%5 = load i32, i32* %3
%6 = icmp uge i32 %5, -2147483648
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -2147483648, i32* %2
br label %18
8: ; preds = %1
br label %9
9: ; preds = %8, %15
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = icmp uge i32 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load i32, i32* %4
store i32 %14, i32* %2
br label %18
15: ; preds = %9
%16 = load i32, i32* %4
%17 = mul i32 %16, 2
store i32 %17, i32* %4
br label %9
18: ; preds = %13, %7
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @next_power(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 256, %1 ]
%5 = icmp ult i32 %4, %0
%6 = shl i32 %4, 1
br i1 %5, label %3, label %7
7: ; preds = %3, %1
%8 = phi i32 [ -2147483648, %1 ], [ %4, %3 ]
ret i32 %8
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void WatchdogResetEnable(uint32_t ui32Base) {
  ASSERT((ui32Base == 0x40000000) || (ui32Base == 0x40001000));
  (*((volatile uint32_t *)(ui32Base + 0x00000008))) |= 0x00000002;
}


x86 assembly (clang, -O0):
<WatchdogResetEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x40000000,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     113a <WatchdogResetEnable+0x2a>
cmpl   $0x40001000,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
or     $0x2,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WatchdogResetEnable>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x40000000,%eax
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
orl    $0x2,0x8(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @WatchdogResetEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1073741824
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 1073745920
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
%11 = call i32 @ASSERT(i32 %10)
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 8
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = or i32 %16, 2
store volatile i32 %17, i32* %15
ret void
}

LLVM IR (-O2):
define void @WatchdogResetEnable(i32 %0) {
%2 = and i32 %0, -4097
%3 = icmp eq i32 %2, 1073741824
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = add nsw i32 %0, 8
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = or i32 %9, 2
store volatile i32 %10, i32* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void clear(void) { system("clear"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @clear() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
int DB_RemoveFileNum_Native(int filenum, void *db) { return 0; }


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

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

LLVM IR (-O0):
define i32 @DB_RemoveFileNum_Native(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @DB_RemoveFileNum_Native(i32 %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test_a() { printf("this is in test_a...\n"); }


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"this is in test_a...\0A\00"
define void @test_a() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"this is in test_a...\00"
define void @test_a() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int Pm_CountDevices();
int Pm_Initialize();
int /*<<< orphan*/ Pt_Start(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ Pt_Stop();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int r = Pm_Initialize();
  if (r != 0) {
    goto error;
  }
  printf("%d\n", Pm_CountDevices());
  Pt_Start(1, NULL, NULL);
  Pt_Stop();
error:
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <Pm_Initialize@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1178 <main+0x28>
jmp    11a5 <main+0x55>
mov    $0x0,%al
call   1050 <Pm_CountDevices@plt>
mov    %eax,%esi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1040 <Pt_Start@plt>
mov    $0x0,%al
call   1060 <Pt_Stop@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <Pm_Initialize@plt>
test   %eax,%eax
jne    1186 <main+0x36>
xor    %eax,%eax
call   1050 <Pm_CountDevices@plt>
lea    0xe96(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <Pt_Start@plt>
xor    %eax,%eax
call   1060 <Pt_Stop@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @Pm_Initialize()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = tail call i32 (...) @Pm_CountDevices()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 @Pt_Start(i32 1, i32* null, i32* null)
%7 = tail call i32 (...) @Pt_Stop()
br label %8
8: ; preds = %0, %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ my_putstr2(char *);
void disp_example() {
  my_putstr2("A valid file map begin with the correct number of rows of the ");
  my_putstr2("map and each rows have the same length.\nEach elements of the ");
  my_putstr2("map are '.' or 'o'.\nIf any other caracters are found, the map ");
  my_putstr2("is considered as wrong and is not executed.\n");
}


x86 assembly (clang, -O0):
<disp_example>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xf18(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xf4a(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xf7d(%rip),%rdi
call   1030 <my_putstr2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<disp_example>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xf1b(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xf4d(%rip),%rdi
call   1030 <my_putstr2@plt>
lea    0xf80(%rip),%rdi
pop    %rax
jmp    1030 <my_putstr2@plt>

LLVM IR (-O0):
@.str = [63 x i8] c"A valid file map begin with the correct number of rows of the \00"
@.str.1 = [62 x i8] c"map and each rows have the same length.\0AEach elements of the \00"
@.str.2 = [63 x i8] c"map are '.' or 'o'.\0AIf any other caracters are found, the map \00"
@.str.3 = [45 x i8] c"is considered as wrong and is not executed.\0A\00"
define void @disp_example() {
%1 = call i32 @my_putstr2(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @my_putstr2(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @my_putstr2(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @my_putstr2(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [63 x i8] c"A valid file map begin with the correct number of rows of the \00"
@.str.1 = [62 x i8] c"map and each rows have the same length.\0AEach elements of the \00"
@.str.2 = [63 x i8] c"map are '.' or 'o'.\0AIf any other caracters are found, the map \00"
@.str.3 = [45 x i8] c"is considered as wrong and is not executed.\0A\00"
define void @disp_example() {
%1 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @my_putstr2(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int do_smbus_write_byte(int, unsigned int, unsigned int, unsigned char);
int smbus_write_byte(unsigned device, unsigned address, unsigned char val) {
  return do_smbus_write_byte(0x1000, device, address, val);
}


x86 assembly (clang, -O0):
<smbus_write_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x1000,%edi
movzbl -0x9(%rbp),%ecx
call   1030 <do_smbus_write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smbus_write_byte>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    $0x1000,%edi
jmp    1030 <do_smbus_write_byte@plt>

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

LLVM IR (-O2):
define i32 @smbus_write_byte(i32 %0, i32 %1, i8 zeroext %2) {
%4 = tail call i32 @do_smbus_write_byte(i32 4096, i32 %0, i32 %1, i8 zeroext %2)
ret i32 %4
}
/* Variables and functions */
double merc_lon(double);
double geohashGetXWGS84(double x) { return merc_lon(x); }


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

x86 assembly (clang, -O2):
<geohashGetXWGS84>:
jmp    1030 <merc_lon@plt>

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

LLVM IR (-O2):
define double @geohashGetXWGS84(double %0) {
%2 = tail call double @merc_lon(double %0)
ret double %2
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_year;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(void *);
int date_get_year(void) {
  time_t t;
  struct tm *lt;
  t = time((void *)0);
  lt = localtime(&t);
  return lt->tm_year + 1900;
}


x86 assembly (clang, -O0):
<date_get_year>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x76c,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_get_year>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    $0x76c,%ecx
add    (%rax),%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @date_get_year() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i8* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1900
ret i32 %8
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @date_get_year() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i8* null)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 1900
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ io_print(char *, char const *);
void print_opt(const char *opt) {
  io_print("\t\t\t\t\t<Add option=\"%s\" />\n", opt);
}


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"\09\09\09\09\09<Add option=\22%s\22 />\0A\00"
define void @print_opt(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @io_print(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"\09\09\09\09\09<Add option=\22%s\22 />\0A\00"
define void @print_opt(i8* %0) {
%2 = tail call i32 @io_print(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gds_swap2bytes(unsigned char *);
int /*<<< orphan*/ write(int, short *, int);
void gds_write_endstr(int fd) {
  static short int count, token;
  count = 4;
  gds_swap2bytes((unsigned char *)&count);
  write(fd, &count, 2);
  token = 0x0700;
  gds_swap2bytes((unsigned char *)&token);
  write(fd, &token, 2);
}


x86 assembly (clang, -O0):
<gds_write_endstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movw   $0x4,0x2efe(%rip)
lea    0x2ef7(%rip),%rdi
call   1040 <gds_swap2bytes@plt>
mov    -0x4(%rbp),%edi
lea    0x2ee8(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
movw   $0x700,0x2ed7(%rip)
lea    0x2ed0(%rip),%rdi
call   1040 <gds_swap2bytes@plt>
mov    -0x4(%rbp),%edi
lea    0x2ec1(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gds_write_endstr>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
movw   $0x4,0x2f03(%rip)
lea    0x2efc(%rip),%r14
mov    %r14,%rdi
call   1040 <gds_swap2bytes@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <write@plt>
movw   $0x700,0x2ede(%rip)
lea    0x2ed7(%rip),%r14
mov    %r14,%rdi
call   1040 <gds_swap2bytes@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x2,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <write@plt>

LLVM IR (-O0):
@gds_write_endstr.count = internal global i16 0
@gds_write_endstr.token = internal global i16 0
define void @gds_write_endstr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store i16 4, i16* @gds_write_endstr.count
%3 = call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_endstr.count to i8*))
%4 = load i32, i32* %2
%5 = call i32 @write(i32 %4, i16* @gds_write_endstr.count, i32 2)
store i16 1792, i16* @gds_write_endstr.token
%6 = call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_endstr.token to i8*))
%7 = load i32, i32* %2
%8 = call i32 @write(i32 %7, i16* @gds_write_endstr.token, i32 2)
ret void
}

LLVM IR (-O2):
@gds_write_endstr.count = internal global i16 0
@gds_write_endstr.token = internal global i16 0
define void @gds_write_endstr(i32 %0) {
store i16 4, i16* @gds_write_endstr.count
%2 = tail call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_endstr.count to i8*))
%3 = tail call i32 @write(i32 %0, i16* @gds_write_endstr.count, i32 2)
store i16 1792, i16* @gds_write_endstr.token
%4 = tail call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_endstr.token to i8*))
%5 = tail call i32 @write(i32 %0, i16* @gds_write_endstr.token, i32 2)
ret void
}