xunge/DecIR huggingface dataset:
/* Variables and functions */
int get_object_area(int, int /*<<< orphan*/);
scalar_t__ get_object_count(int);
int cam_area(int channel) {
  if (get_object_count(channel) > 0) {
    return get_object_area(channel, 0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<cam_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <get_object_count@plt>
cmp    $0x0,%rax
jle    114f <cam_area+0x2f>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1040 <get_object_area@plt>
mov    %eax,-0x4(%rbp)
jmp    1156 <cam_area+0x36>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cam_area>:
push   %rbx
mov    %edi,%ebx
call   1030 <get_object_count@plt>
test   %rax,%rax
jle    1137 <cam_area+0x17>
mov    %ebx,%edi
xor    %esi,%esi
pop    %rbx
jmp    1040 <get_object_area@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cam_area(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @get_object_count(i32 %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i32 @get_object_area(i32 %8, i32 0)
store i32 %9, i32* %2
br label %11
10: ; preds = %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %7
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @cam_area(i32 %0) {
%2 = tail call i64 @get_object_count(i32 %0)
%3 = icmp sgt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @get_object_area(i32 %0, i32 0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
bool nrf52_errata_32(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_32() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char const *, char *, double *);
double atof(const char *str) {
  double result;
  sscanf(str, "%lf", &result);
  return result;
}


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

x86 assembly (clang, -O2):
<atof>:
push   %rax
lea    0xee8(%rip),%rsi
mov    %rsp,%rdx
call   1030 <sscanf@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define double @atof(i8* nocapture %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%5 = load double, double* %2
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int rtc_read_datetime(struct tm *tm) {
  time_t now = time(NULL);
  *tm = *localtime(&now);
  return 0;
}


x86 assembly (clang, -O0):
<rtc_read_datetime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    (%rcx),%ecx
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtc_read_datetime>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%eax
mov    %eax,(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @rtc_read_datetime(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca i32
store %struct.tm* %0, %struct.tm** %2
%4 = call i32 @time(i32* null)
store i32 %4, i32* %3
%5 = load %struct.tm*, %struct.tm** %2
%6 = call %struct.tm* @localtime(i32* %3)
%7 = bitcast %struct.tm* %5 to i8*
%8 = bitcast %struct.tm* %6 to i8*
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @rtc_read_datetime(%struct.tm* nocapture writeonly %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @time(i32* null)
store i32 %4, i32* %2
%5 = call %struct.tm* @localtime(i32* %2)
%6 = getelementptr %struct.tm, %struct.tm* %5, i64 0, i32 0
%7 = getelementptr %struct.tm, %struct.tm* %0, i64 0, i32 0
%8 = load i32, i32* %6
store i32 %8, i32* %7
ret i32 0
}
int eq_int(const void *a, const void *b) {
  return (*(const int *)a == *(const int *)b);
}


x86 assembly (clang, -O0):
<eq_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eq_int>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @eq_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = icmp eq i32 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @eq_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp eq i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int gca_cmp2_uint32(const void *aa, const void *bb, void *p) {
  (void)p;
  const uint32_t a = *(const uint32_t *)aa;
  const uint32_t b = *(const uint32_t *)bb;
  return (((a) > (b)) - ((b) > (a)));
}


x86 assembly (clang, -O0):
<gca_cmp2_uint32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x28(%rbp),%rcx
cmp    -0x20(%rbp),%rcx
setg   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gca_cmp2_uint32>:
mov    (%rdi),%rcx
mov    (%rsi),%rdx
xor    %eax,%eax
xor    %esi,%esi
cmp    %rdx,%rcx
setg   %al
setl   %sil
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @gca_cmp2_uint32(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i64*
%12 = load i64, i64* %11
store i64 %12, i64* %7
%13 = load i8*, i8** %5
%14 = bitcast i8* %13 to i64*
%15 = load i64, i64* %14
store i64 %15, i64* %8
%16 = load i64, i64* %7
%17 = load i64, i64* %8
%18 = icmp sgt i64 %16, %17
%19 = zext i1 %18 to i32
%20 = load i64, i64* %8
%21 = load i64, i64* %7
%22 = icmp sgt i64 %20, %21
%23 = zext i1 %22 to i32
%24 = sub nsw i32 %19, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @gca_cmp2_uint32(i8* nocapture %0, i8* nocapture %1, i8* nocapture readnone %2) {
%4 = bitcast i8* %0 to i64*
%5 = load i64, i64* %4
%6 = bitcast i8* %1 to i64*
%7 = load i64, i64* %6
%8 = icmp sgt i64 %5, %7
%9 = zext i1 %8 to i32
%10 = icmp sgt i64 %7, %5
%11 = sext i1 %10 to i32
%12 = add nsw i32 %11, %9
ret i32 %12
}
/* Variables and functions */
uintptr_t adjust_function_address(uintptr_t func_addr) { return func_addr; }


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

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

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

LLVM IR (-O2):
define i64 @adjust_function_address(i64 returned %0) {
ret i64 %0
}
long long *dynamic_configuration_get_last_change() {
  static long long last_change = 0;
  return &last_change;
}


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

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

LLVM IR (-O0):
@dynamic_configuration_get_last_change.last_change = internal global i64 0
define i64* @dynamic_configuration_get_last_change() {
ret i64* @dynamic_configuration_get_last_change.last_change
}

LLVM IR (-O2):
@dynamic_configuration_get_last_change.last_change = internal global i64 0
define i64* @dynamic_configuration_get_last_change() {
ret i64* @dynamic_configuration_get_last_change.last_change
}
int bcd_encode(int i, int n, char *s) {
  int index;
  index = 1;
  while (i != 0) {
    s[index] = (i % 10) + 48;
    i = i / 10;
    index++;
  }
  s[0] = (index - 1) + 48;
  return 0;
}


x86 assembly (clang, -O0):
<bcd_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1154 <bcd_encode+0x54>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <bcd_encode+0x15>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcd_encode>:
test   %edi,%edi
je     114b <bcd_encode+0x4b>
mov    $0x1,%eax
nopl   0x0(%rax)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdi
add    %esi,%edi
lea    (%rdi,%rdi,1),%esi
lea    (%rsi,%rsi,4),%r8d
mov    %ecx,%esi
sub    %r8d,%esi
add    $0x30,%sil
mov    %sil,(%rdx,%rax,1)
add    $0x1,%rax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <bcd_encode+0x10>
add    $0x2f,%al
jmp    114d <bcd_encode+0x4d>
mov    $0x30,%al
mov    %al,(%rdx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @bcd_encode(i32 %0, i32 %1, i8* nocapture writeonly %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %19, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %13, %5 ], [ 1, %3 ]
%7 = phi i32 [ %12, %5 ], [ %0, %3 ]
%8 = srem i32 %7, 10
%9 = trunc i32 %8 to i8
%10 = add nsw i8 %9, 48
%11 = getelementptr inbounds i8, i8* %2, i64 %6
store i8 %10, i8* %11
%12 = sdiv i32 %7, 10
%13 = add nuw i64 %6, 1
%14 = add i32 %7, 9
%15 = icmp ult i32 %14, 19
br i1 %15, label %16, label %5
16: ; preds = %5
%17 = trunc i64 %13 to i8
%18 = add i8 %17, 47
br label %19
19: ; preds = %16, %3
%20 = phi i8 [ 48, %3 ], [ %18, %16 ]
store i8 %20, i8* %2
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void dumpstream(int track, uint8_t *stream, int len) {}


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

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

LLVM IR (-O0):
define void @dumpstream(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
ret void
}

LLVM IR (-O2):
define void @dumpstream(i32 %0, i32* nocapture %1, i32 %2) {
ret void
}
unsigned short ones_s(register unsigned short x) {
  x -= ((x >> 1) & 0x5555);
  x = (((x >> 2) & 0x3333) + (x & 0x3333));
  x = (((x >> 4) + x) & (0x0f0f));
  x += (x >> 8);
  return (x & 0x3f);
}


x86 assembly (clang, -O0):
<ones_s>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%ecx
sar    $0x1,%ecx
and    $0x5555,%ecx
movzwl -0x2(%rbp),%eax
sub    %ecx,%eax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x2,%eax
and    $0x3333,%eax
movzwl -0x2(%rbp),%ecx
and    $0x3333,%ecx
add    %ecx,%eax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x4,%eax
movzwl -0x2(%rbp),%ecx
add    %ecx,%eax
and    $0xf0f,%eax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%ecx
sar    $0x8,%ecx
movzwl -0x2(%rbp),%eax
add    %ecx,%eax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
and    $0x3f,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ones_s>:
mov    %edi,%eax
shr    %eax
and    $0x5555,%eax
sub    %eax,%edi
mov    %edi,%eax
shr    $0x2,%eax
and    $0x3333,%eax
and    $0x3333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
add    %eax,%ecx
movzbl %cl,%eax
ret

LLVM IR (-O0):
define zeroext i16 @ones_s(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 1
%6 = and i32 %5, 21845
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
%9 = sub nsw i32 %8, %6
%10 = trunc i32 %9 to i16
store i16 %10, i16* %2
%11 = load i16, i16* %2
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 2
%14 = and i32 %13, 13107
%15 = load i16, i16* %2
%16 = zext i16 %15 to i32
%17 = and i32 %16, 13107
%18 = add nsw i32 %14, %17
%19 = trunc i32 %18 to i16
store i16 %19, i16* %2
%20 = load i16, i16* %2
%21 = zext i16 %20 to i32
%22 = ashr i32 %21, 4
%23 = load i16, i16* %2
%24 = zext i16 %23 to i32
%25 = add nsw i32 %22, %24
%26 = and i32 %25, 3855
%27 = trunc i32 %26 to i16
store i16 %27, i16* %2
%28 = load i16, i16* %2
%29 = zext i16 %28 to i32
%30 = ashr i32 %29, 8
%31 = load i16, i16* %2
%32 = zext i16 %31 to i32
%33 = add nsw i32 %32, %30
%34 = trunc i32 %33 to i16
store i16 %34, i16* %2
%35 = load i16, i16* %2
%36 = zext i16 %35 to i32
%37 = and i32 %36, 63
%38 = trunc i32 %37 to i16
ret i16 %38
}

LLVM IR (-O2):
define zeroext i16 @ones_s(i16 zeroext %0) {
%2 = lshr i16 %0, 1
%3 = and i16 %2, 21845
%4 = sub i16 %0, %3
%5 = lshr i16 %4, 2
%6 = and i16 %5, 13107
%7 = and i16 %4, 13107
%8 = add nuw nsw i16 %6, %7
%9 = lshr i16 %8, 4
%10 = add nuw nsw i16 %9, %8
%11 = and i16 %10, 3855
%12 = lshr i16 %11, 8
%13 = add nuw nsw i16 %12, %11
%14 = and i16 %13, 31
ret i16 %14
}
int round_int(double r) { return (r > 0.0) ? (r + 0.5) : (r - 0.5); }


x86 assembly (clang, -O0):
<round_int>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1132 <round_int+0x32>
movsd  0xedd(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1148 <round_int+0x48>
movsd  -0x8(%rbp),%xmm0
movsd  0xec1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_int>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @round_int(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = fadd double %6, 5.000000e-01
br label %11
8: ; preds = %1
%9 = load double, double* %2
%10 = fsub double %9, 5.000000e-01
br label %11
11: ; preds = %8, %5
%12 = phi double [ %7, %5 ], [ %10, %8 ]
%13 = fptosi double %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @round_int(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = select i1 %2, double 5.000000e-01, double -5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Usage:\n"
         "    julia [-s signal]    signal could only be stop\n");
  exit((0));
}


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

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

LLVM IR (-O0):
@.str = [59 x i8] c"Usage:\0A julia [-s signal] signal could only be stop\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [58 x i8] c"Usage:\0A julia [-s signal] signal could only be stop\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ enable_servo(int);
int /*<<< orphan*/ msleep(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ set_servo_position(int, int);
void servoInit() {
  enable_servo(3);
  enable_servo(2);
  set_servo_position(3, 1024);
  set_servo_position(2, 100);
  msleep(600);
  printf("Servo initialized!\n");
}


x86 assembly (clang, -O0):
<servoInit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1050 <enable_servo@plt>
mov    $0x2,%edi
call   1050 <enable_servo@plt>
mov    $0x3,%edi
mov    $0x400,%esi
call   1060 <set_servo_position@plt>
mov    $0x2,%edi
mov    $0x64,%esi
call   1060 <set_servo_position@plt>
mov    $0x258,%edi
call   1030 <msleep@plt>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<servoInit>:
push   %rax
mov    $0x3,%edi
call   1050 <enable_servo@plt>
mov    $0x2,%edi
call   1050 <enable_servo@plt>
mov    $0x3,%edi
mov    $0x400,%esi
call   1060 <set_servo_position@plt>
mov    $0x2,%edi
mov    $0x64,%esi
call   1060 <set_servo_position@plt>
mov    $0x258,%edi
call   1040 <msleep@plt>
lea    0xe7c(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Servo initialized!\0A\00"
define void @servoInit() {
%1 = call i32 @enable_servo(i32 3)
%2 = call i32 @enable_servo(i32 2)
%3 = call i32 @set_servo_position(i32 3, i32 1024)
%4 = call i32 @set_servo_position(i32 2, i32 100)
%5 = call i32 @msleep(i32 600)
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"Servo initialized!\00"
define void @servoInit() {
%1 = tail call i32 @enable_servo(i32 3)
%2 = tail call i32 @enable_servo(i32 2)
%3 = tail call i32 @set_servo_position(i32 3, i32 1024)
%4 = tail call i32 @set_servo_position(i32 2, i32 100)
%5 = tail call i32 @msleep(i32 600)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int strncasecmp(char const *, char const *, size_t);
int strnicmp(const char *a, const char *b, size_t n) {
  return strncasecmp(a, b, n);
}


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

x86 assembly (clang, -O2):
<strnicmp>:
jmp    1030 <strncasecmp@plt>

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

LLVM IR (-O2):
define i32 @strnicmp(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @strncasecmp(i8* %0, i8* %1, i64 %2)
ret i32 %4
}
/* Variables and functions */
long double __infer_nondet_long_double();
long double floorl(long double x) { return __infer_nondet_long_double(); }


x86 assembly (clang, -O0):
<floorl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
xor    %eax,%eax
call   1030 <__infer_nondet_long_double@plt>
fld    %st(0)
fstp   %st(0)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define x86_fp80 @floorl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = call x86_fp80 (...) @__infer_nondet_long_double()
ret x86_fp80 %3
}

LLVM IR (-O2):
define x86_fp80 @floorl(x86_fp80 %0) {
%2 = tail call x86_fp80 (...) @__infer_nondet_long_double()
ret x86_fp80 %2
}
/* Type definitions */
typedef int time_t;
struct timeval {
  int tv_sec;
};

/* Variables and functions */
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
time_t time(time_t *timep) {
  struct timeval tv;
  if (gettimeofday(&tv, NULL) != 0)
    return -1;
  if (timep)
    *timep = tv.tv_sec;
  return tv.tv_sec;
}


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
je     113f <time+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1159 <time+0x49>
cmpq   $0x0,-0x10(%rbp)
je     1153 <time+0x43>
mov    -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    113c <time+0x2c>
mov    0x8(%rsp),%eax
test   %rbx,%rbx
je     113c <time+0x2c>
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @time(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca %struct.timeval
store i32* %0, i32** %3
%5 = call i64 @gettimeofday(%struct.timeval* %4, i32* null)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %18
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%13 = load i32, i32* %12
%14 = load i32*, i32** %3
store i32 %13, i32* %14
br label %15
15: ; preds = %11, %8
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%17 = load i32, i32* %16
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %7
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @time(i32* writeonly %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i64 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = icmp eq i32* %0, null
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%9 = load i32, i32* %8
br i1 %7, label %11, label %10
10: ; preds = %6
store i32 %9, i32* %0
br label %11
11: ; preds = %6, %10, %1
%12 = phi i32 [ -1, %1 ], [ %9, %10 ], [ %9, %6 ]
ret i32 %12
}
int f(int a, int b) { return a - b % b; }


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

x86 assembly (clang, -O2):
<f>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 returned %0, i32 %1) {
ret i32 %0
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *strdup(register const char *s1) {
  register char *s;
  register size_t l = (strlen(s1) + 1) * sizeof(char);
  if ((s = malloc(l)) != NULL) {
    memcpy(s, s1, l);
  }
  return s;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     117a <strdup+0x4a>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1161 <strdup+0x31>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 1
store i64 %9, i64* %4
%10 = load i64, i64* %4
%11 = call i8* @malloc(i64 %10)
store i8* %11, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %1
%14 = load i8*, i8** %3
%15 = load i8*, i8** %2
%16 = load i64, i64* %4
%17 = call i32 @memcpy(i8* %14, i8* %15, i64 %16)
br label %18
18: ; preds = %13, %1
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %4)
br label %9
9: ; preds = %7, %1
ret i8* %5
}
/* Variables and functions */
char *strcat(char *, char const *);
char *htx_strcat(char *dest, const char *src) { return strcat(dest, src); }


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

x86 assembly (clang, -O2):
<htx_strcat>:
jmp    1030 <strcat@plt>

LLVM IR (-O0):
define i8* @htx_strcat(i8* %0, i8* %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* @strcat(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @htx_strcat(i8* returned %0, i8* nocapture %1) {
%3 = tail call i8* @strcat(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int f32_to_uf10(float const);
int f32_to_uf11(float const);
uint32_t float3_to_r11g11b10f(const float rgb[3]) {
  return (f32_to_uf11(rgb[0]) & 0x7ff) | ((f32_to_uf11(rgb[1]) & 0x7ff) << 11) |
         ((f32_to_uf10(rgb[2]) & 0x3ff) << 22);
}


x86 assembly (clang, -O0):
<float3_to_r11g11b10f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
call   1030 <f32_to_uf11@plt>
and    $0x7ff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
call   1030 <f32_to_uf11@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
and    $0x7ff,%ecx
shl    $0xb,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
call   1040 <f32_to_uf10@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
and    $0x3ff,%ecx
shl    $0x16,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<float3_to_r11g11b10f>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
movss  (%rdi),%xmm0
call   1030 <f32_to_uf11@plt>
mov    %eax,%ebp
and    $0x7ff,%ebp
movss  0x4(%r14),%xmm0
call   1030 <f32_to_uf11@plt>
mov    %eax,%ebx
shl    $0xb,%ebx
and    $0x3ff800,%ebx
or     %ebp,%ebx
movss  0x8(%r14),%xmm0
call   1040 <f32_to_uf10@plt>
shl    $0x16,%eax
or     %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @float3_to_r11g11b10f(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
%5 = load float, float* %4
%6 = call i32 @f32_to_uf11(float %5)
%7 = and i32 %6, 2047
%8 = load float*, float** %2
%9 = getelementptr inbounds float, float* %8, i64 1
%10 = load float, float* %9
%11 = call i32 @f32_to_uf11(float %10)
%12 = and i32 %11, 2047
%13 = shl i32 %12, 11
%14 = or i32 %7, %13
%15 = load float*, float** %2
%16 = getelementptr inbounds float, float* %15, i64 2
%17 = load float, float* %16
%18 = call i32 @f32_to_uf10(float %17)
%19 = and i32 %18, 1023
%20 = shl i32 %19, 22
%21 = or i32 %14, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @float3_to_r11g11b10f(float* nocapture %0) {
%2 = load float, float* %0
%3 = tail call i32 @f32_to_uf11(float %2)
%4 = and i32 %3, 2047
%5 = getelementptr inbounds float, float* %0, i64 1
%6 = load float, float* %5
%7 = tail call i32 @f32_to_uf11(float %6)
%8 = shl i32 %7, 11
%9 = and i32 %8, 4192256
%10 = or i32 %4, %9
%11 = getelementptr inbounds float, float* %0, i64 2
%12 = load float, float* %11
%13 = tail call i32 @f32_to_uf10(float %12)
%14 = shl i32 %13, 22
%15 = or i32 %10, %14
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ fftss_cleanup_threads();
void DFFTSS_CLEANUP_THREADS_(void) { fftss_cleanup_threads(); }


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

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

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

LLVM IR (-O2):
define void @DFFTSS_CLEANUP_THREADS_() {
%1 = tail call i32 (...) @fftss_cleanup_threads()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ memcpy(void *, void *, size_t);
void *realloc(void *ptr, size_t size) {
  void *out = (void *)malloc(size);
  if (!out)
    return NULL;
  if (ptr) {
    memcpy(out, ptr, size);
    free(ptr);
  }
  return out;
}


x86 assembly (clang, -O0):
<realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1165 <realloc+0x35>
movq   $0x0,-0x8(%rbp)
jmp    1192 <realloc+0x62>
cmpq   $0x0,-0x10(%rbp)
je     118a <realloc+0x5a>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realloc>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     1168 <realloc+0x38>
mov    %rax,%rbx
test   %r14,%r14
je     116a <realloc+0x3a>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    116a <realloc+0x3a>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i64, i64* %5
%8 = call i64 @malloc(i64 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %2
store i8* null, i8** %3
br label %25
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i8*, i8** %6
%18 = load i8*, i8** %4
%19 = load i64, i64* %5
%20 = call i32 @memcpy(i8* %17, i8* %18, i64 %19)
%21 = load i8*, i8** %4
%22 = call i32 @free(i8* %21)
br label %23
23: ; preds = %16, %13
%24 = load i8*, i8** %6
store i8* %24, i8** %3
br label %25
25: ; preds = %23, %12
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
define i8* @realloc(i8* %0, i64 %1) {
%3 = tail call i64 @malloc(i64 %1)
%4 = inttoptr i64 %3 to i8*
%5 = icmp eq i64 %3, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = icmp eq i8* %0, null
br i1 %7, label %11, label %8
8: ; preds = %6
%9 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %1)
%10 = tail call i32 @free(i8* %0)
br label %11
11: ; preds = %6, %8, %2
%12 = phi i8* [ null, %2 ], [ %4, %8 ], [ %4, %6 ]
ret i8* %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char const *, char const *);
FILE *fossil_fopen(const char *zName, const char *zMode) {
  FILE *f = fopen(zName, zMode);
  return f;
}


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

x86 assembly (clang, -O2):
<fossil_fopen>:
jmp    1030 <fopen@plt>

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

LLVM IR (-O2):
define noalias i32* @fossil_fopen(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
ret i32* %3
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_ino;
};
typedef int /*<<< orphan*/ ino_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
scalar_t__ stat(char *, struct stat *);
ino_t get_ino_byname(char *filename) {
  struct stat file_stat;
  if (0 != stat(filename, &file_stat)) {
    perror("stat");
    exit(-1);
  }
  return file_stat.st_ino;
}


x86 assembly (clang, -O0):
<get_ino_byname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     116d <get_ino_byname+0x3d>
lea    0xea2(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ino_byname>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
test   %rax,%rax
jne    1143 <get_ino_byname+0x13>
mov    (%rsp),%eax
pop    %rcx
ret
lea    0xeb6(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [5 x i8] c"stat\00"
define i32 @get_ino_byname(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @stat(i8* %4, %struct.stat* %3)
%6 = icmp ne i64 0, %5
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 -1)
unreachable
10: ; preds = %1
%11 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [5 x i8] c"stat\00"
define i32 @get_ino_byname(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 -1)
unreachable
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%11 = load i32, i32* %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ mqtt_client_sample_run();
int main(void) {
  mqtt_client_sample_run();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @mqtt_client_sample_run()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @mqtt_client_sample_run()
ret i32 0
}
__attribute__((always_)) int a(int i, int j) { return (i << 5) + j; }


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

x86 assembly (clang, -O2):
<a>:
shl    $0x5,%edi
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @a(i32 %0, i32 %1) {
%3 = shl i32 %0, 5
%4 = add nsw i32 %3, %1
ret i32 %4
}
/* Variables and functions */
void *calloc(int, size_t);
void *malloc(size_t size) {
  ;
  return calloc(1, size);
}


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

x86 assembly (clang, -O2):
<malloc>:
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define i8* @malloc(i64 %0) {
%2 = tail call i8* @calloc(i32 1, i64 %0)
ret i8* %2
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ int16_t;

/* Variables and functions */
int eval(uint64_t a, uint64_t b) {
  int16_t ma = 0xFFFF & a;
  int16_t mb = 0xFFFF & b;
  return ma == mb;
}


x86 assembly (clang, -O0):
<eval>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    $0xffff,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval>:
xor    %eax,%eax
xor    %di,%si
sete   %al
ret

LLVM IR (-O0):
define i32 @eval(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = and i32 65535, %7
%9 = sext i32 %8 to i64
store i64 %9, i64* %5
%10 = load i32, i32* %4
%11 = and i32 65535, %10
%12 = sext i32 %11 to i64
store i64 %12, i64* %6
%13 = load i64, i64* %5
%14 = load i64, i64* %6
%15 = icmp eq i64 %13, %14
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @eval(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = and i32 %3, 65535
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int munmap(void *, size_t);
void dropcore(void *p, size_t size_in_bytes) {
  if (p != NULL) {
    int ret = munmap(p, size_in_bytes);
    assert(ret == 0);
  }
}


x86 assembly (clang, -O0):
<dropcore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115c <dropcore+0x3c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <munmap@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dropcore>:
test   %rdi,%rdi
je     1139 <dropcore+0x19>
push   %rax
call   1040 <munmap@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
pop    %rax
jmp    1030 <assert@plt>
ret

LLVM IR (-O0):
define void @dropcore(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = call i32 @munmap(i8* %9, i64 %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
br label %16
16: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
define void @dropcore(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i32 @munmap(i8* %0, i64 %1)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
br label %9
9: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct t_relay_dogechat_msg {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ relay_dogechat_msg_add_bytes(struct t_relay_dogechat_msg *,
                                                int /*<<< orphan*/ *, int);
void relay_dogechat_msg_add_int(struct t_relay_dogechat_msg *msg, int value) {
  uint32_t value32;
  value32 = htonl((uint32_t)value);
  relay_dogechat_msg_add_bytes(msg, &value32, 4);
}


x86 assembly (clang, -O0):
<relay_dogechat_msg_add_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <htonl@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1040 <relay_dogechat_msg_add_bytes@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relay_dogechat_msg_add_int>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <htonl@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <relay_dogechat_msg_add_bytes@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.t_relay_dogechat_msg = type { i32 }
define void @relay_dogechat_msg_add_int(%struct.t_relay_dogechat_msg* %0, i32 %1) {
%3 = alloca %struct.t_relay_dogechat_msg*
%4 = alloca i32
%5 = alloca i32
store %struct.t_relay_dogechat_msg* %0, %struct.t_relay_dogechat_msg** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = call i32 @htonl(i32 %6)
store i32 %7, i32* %5
%8 = load %struct.t_relay_dogechat_msg*, %struct.t_relay_dogechat_msg** %3
%9 = call i32 @relay_dogechat_msg_add_bytes(%struct.t_relay_dogechat_msg* %8, i32* %5, i32 4)
ret void
}

LLVM IR (-O2):
%struct.t_relay_dogechat_msg = type { i32 }
define void @relay_dogechat_msg_add_int(%struct.t_relay_dogechat_msg* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @htonl(i32 %1)
store i32 %5, i32* %3
%6 = call i32 @relay_dogechat_msg_add_bytes(%struct.t_relay_dogechat_msg* %0, i32* %3, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, char *, double *, double *);
int main(void) {
  char nome[64];
  double salary, sells;
  scanf("%s %lf %lf", nome, &salary, &sells);
  printf("TOTAL = R$ %.2f\n", salary + sells * 0.15);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rsi
lea    0xece(%rip),%rdi
lea    -0x58(%rbp),%rdx
lea    -0x60(%rbp),%rcx
call   1040 <scanf@plt>
movsd  -0x58(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  0xea7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
lea    0xedd(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
mulsd  0xeb6(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%s %lf %lf\00"
@.str.1 = [17 x i8] c"TOTAL = R$ %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [64 x i8]
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5, double* %3, double* %4)
%7 = load double, double* %3
%8 = load double, double* %4
%9 = call double @llvm.fmuladd.f64(double %8, double 1.500000e-01, double %7)
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s %lf %lf\00"
@.str.1 = [17 x i8] c"TOTAL = R$ %.2f\0A\00"
define i32 @main() {
%1 = alloca [64 x i8]
%2 = alloca double
%3 = alloca double
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4, double* %2, double* %3)
%8 = load double, double* %2
%9 = load double, double* %3
%10 = call double @llvm.fmuladd.f64(double %9, double 1.500000e-01, double %8)
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %10)
ret i32 0
}
unsigned kol_key_lang_get() { asm("int $0x40" ::"a"(26), "b"(2), "c"(9)); }


x86 assembly (clang, -O0):
<kol_key_lang_get>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    $0x1a,%eax
mov    $0x2,%ebx
mov    $0x9,%ecx
int    $0x40
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_key_lang_get>:
push   %rbx
mov    $0x1a,%eax
mov    $0x2,%ebx
mov    $0x9,%ecx
int    $0x40
pop    %rbx
ret

LLVM IR (-O0):
define i32 @kol_key_lang_get() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @kol_key_lang_get() {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 26, i32 2, i32 9)
ret i32 undef
}