xunge/DecIR huggingface dataset:
void uppercase(ch) char *ch;
{ *ch = (islower(*ch) ? toupper(*ch) : (*ch)); }


x86 assembly (clang, -O0):
<uppercase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <islower@plt>
cmp    $0x0,%eax
je     1155 <uppercase+0x35>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <toupper@plt>
mov    %eax,-0xc(%rbp)
jmp    115f <uppercase+0x3f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uppercase>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%ebp
mov    %ebp,%edi
call   1030 <islower@plt>
test   %eax,%eax
je     113d <uppercase+0x1d>
mov    %ebp,%edi
call   1040 <toupper@plt>
mov    %eax,%ebp
mov    %bpl,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @uppercase(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = tail call i32 @islower(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @toupper(i32 %3)
br label %8
8: ; preds = %1, %6
%9 = phi i32 [ %7, %6 ], [ %3, %1 ]
%10 = trunc i32 %9 to i8
store i8 %10, i8* %0
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void tsaf_clear_discontinuity(uint8_t *p_ts) { p_ts[5] &= ~0x80; }


x86 assembly (clang, -O0):
<tsaf_clear_discontinuity>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%ecx
and    $0xffffff7f,%ecx
mov    %ecx,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<tsaf_clear_discontinuity>:
andb   $0x7f,0x14(%rdi)
ret

LLVM IR (-O0):
define void @tsaf_clear_discontinuity(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 5
%5 = load i32, i32* %4
%6 = and i32 %5, -129
store i32 %6, i32* %4
ret void
}

LLVM IR (-O2):
define void @tsaf_clear_discontinuity(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 5
%3 = load i32, i32* %2
%4 = and i32 %3, -129
store i32 %4, i32* %2
ret void
}
int getent(cp, name)
char *cp, *name;
{ return (0); }


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

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

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

LLVM IR (-O2):
define i32 @getent(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int cfg_processor_get_hex_int_attr(void *, char *);
int cfg_memory_get_area_end_addr(void *area) {
  return cfg_processor_get_hex_int_attr(area, "end");
}


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

x86 assembly (clang, -O2):
<cfg_memory_get_area_end_addr>:
lea    0xee9(%rip),%rsi
jmp    1030 <cfg_processor_get_hex_int_attr@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"end\00"
define i32 @cfg_memory_get_area_end_addr(i8* %0) {
%2 = tail call i32 @cfg_processor_get_hex_int_attr(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
void *func(void *vp) { return vp; }


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

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

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

LLVM IR (-O2):
define i8* @func(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_concat();
int /*<<< orphan*/ test_create_del();
int /*<<< orphan*/ test_get();
int /*<<< orphan*/ test_hash();
int /*<<< orphan*/ test_put();
int main(void) {
  test_create_del();
  test_hash();
  test_put();
  test_get();
  test_concat();
  printf("----------------\nall tests passed\n----------------\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <test_create_del@plt>
mov    $0x0,%al
call   1040 <test_hash@plt>
mov    $0x0,%al
call   1080 <test_put@plt>
mov    $0x0,%al
call   1030 <test_get@plt>
mov    $0x0,%al
call   1070 <test_concat@plt>
lea    0xe67(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <test_create_del@plt>
xor    %eax,%eax
call   1050 <test_hash@plt>
xor    %eax,%eax
call   1080 <test_put@plt>
xor    %eax,%eax
call   1030 <test_get@plt>
xor    %eax,%eax
call   1070 <test_concat@plt>
lea    0xe75(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"----------------\0Aall tests passed\0A----------------\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_create_del()
%3 = call i32 (...) @test_hash()
%4 = call i32 (...) @test_put()
%5 = call i32 (...) @test_get()
%6 = call i32 (...) @test_concat()
%7 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [51 x i8] c"----------------\0Aall tests passed\0A----------------\00"
define i32 @main() {
%1 = tail call i32 (...) @test_create_del()
%2 = tail call i32 (...) @test_hash()
%3 = tail call i32 (...) @test_put()
%4 = tail call i32 (...) @test_get()
%5 = tail call i32 (...) @test_concat()
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int main(void) { '\x0e'; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void I2CDMAEnable(unsigned long ulBase, unsigned long ulDMALast) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000004))) |= 0x00000800;
  (*((volatile unsigned long *)(ulBase + 0x00000004))) &= ~0x00001000;
  (*((volatile unsigned long *)(ulBase + 0x00000004))) |= ulDMALast;
}


x86 assembly (clang, -O0):
<I2CDMAEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%rcx
or     $0x800,%rcx
mov    %rcx,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%rcx
and    $0xffffffffffffefff,%rcx
mov    %rcx,0x4(%rax)
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CDMAEnable>:
orq    $0x800,0x4(%rdi)
andq   $0xffffffffffffefff,0x4(%rdi)
ff
or     %rsi,0x4(%rdi)
ret

LLVM IR (-O0):
define void @I2CDMAEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = add i64 %5, 4
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = or i64 %8, 2048
store volatile i64 %9, i64* %7
%10 = load i64, i64* %3
%11 = add i64 %10, 4
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, -4097
store volatile i64 %14, i64* %12
%15 = load i64, i64* %4
%16 = load i64, i64* %3
%17 = add i64 %16, 4
%18 = inttoptr i64 %17 to i64*
%19 = load volatile i64, i64* %18
%20 = or i64 %19, %15
store volatile i64 %20, i64* %18
ret void
}

LLVM IR (-O2):
define void @I2CDMAEnable(i64 %0, i64 %1) {
%3 = add i64 %0, 4
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = or i64 %5, 2048
store volatile i64 %6, i64* %4
%7 = load volatile i64, i64* %4
%8 = and i64 %7, -4097
store volatile i64 %8, i64* %4
%9 = load volatile i64, i64* %4
%10 = or i64 %9, %1
store volatile i64 %10, i64* %4
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
int _rand_next(unsigned short *);
long jrand48(unsigned short state[3]) {
  uint64_t x = _rand_next(state);
  uint32_t y = (uint32_t)(x >> 16);
  if (y & 0x80000000) {
    return (long)(y & 0x7fffffff);
  } else {
    return -(long)(y & 0x7fffffff);
  }
}


x86 assembly (clang, -O0):
<jrand48>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <_rand_next@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x10,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     1155 <jrand48+0x45>
mov    -0x18(%rbp),%eax
and    $0x7fffffff,%eax
cltq
mov    %rax,-0x8(%rbp)
jmp    1169 <jrand48+0x59>
mov    -0x18(%rbp),%eax
and    $0x7fffffff,%eax
movslq %eax,%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jrand48>:
push   %rax
call   1030 <_rand_next@plt>
mov    %eax,%edx
sar    $0x10,%edx
and    $0x7fffffff,%edx
mov    %rdx,%rcx
neg    %rcx
test   %eax,%eax
cmovs  %rdx,%rcx
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @jrand48(i16* %0) {
%2 = alloca i64
%3 = alloca i16*
%4 = alloca i32
%5 = alloca i32
store i16* %0, i16** %3
%6 = load i16*, i16** %3
%7 = call i32 @_rand_next(i16* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = ashr i32 %8, 16
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = and i32 %10, -2147483648
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %1
%14 = load i32, i32* %5
%15 = and i32 %14, 2147483647
%16 = sext i32 %15 to i64
store i64 %16, i64* %2
br label %22
17: ; preds = %1
%18 = load i32, i32* %5
%19 = and i32 %18, 2147483647
%20 = sext i32 %19 to i64
%21 = sub nsw i64 0, %20
store i64 %21, i64* %2
br label %22
22: ; preds = %17, %13
%23 = load i64, i64* %2
ret i64 %23
}

LLVM IR (-O2):
define i64 @jrand48(i16* %0) {
%2 = tail call i32 @_rand_next(i16* %0)
%3 = ashr i32 %2, 16
%4 = icmp sgt i32 %2, -1
%5 = and i32 %3, 2147483647
%6 = zext i32 %5 to i64
%7 = sub nsw i64 0, %6
%8 = select i1 %4, i64 %7, i64 %6
ret i64 %8
}
int gpio_to_irq(int which_one) { return 49; }


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

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

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

LLVM IR (-O2):
define i32 @gpio_to_irq(i32 %0) {
ret i32 49
}
/* Type definitions */
struct region {
  int dummy;
};

/* Variables and functions */
void region_free(struct region *);
void region_destroy(struct region *region) { return region_free(region); }


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

x86 assembly (clang, -O2):
<region_destroy>:
jmp    1030 <region_free@plt>

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

LLVM IR (-O2):
%struct.region = type { i32 }
define void @region_destroy(%struct.region* %0) {
tail call void @region_free(%struct.region* %0)
ret void
}
int test_imm_10int64_highword_reg(long long val) {
  return ((val >> 32) & (0x10 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_10int64_highword_reg>:
bt     $0x24,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_10int64_highword_reg(i64 %0) {
%2 = and i64 %0, 68719476736
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
long long rtapi_get_clocks(void) {
  long long int retval;
  __asm__ __volatile__("rdtsc" : "=A"(retval));
  return retval;
}


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

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

LLVM IR (-O0):
define i64 @rtapi_get_clocks() {
%1 = alloca i64
%2 = call i64 asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @rtapi_get_clocks() {
%1 = tail call i64 asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char const *, char const *);
scalar_t__ strlen(char const *);
int string_compare(const char *a, const char *b) {
  return strlen(a) == strlen(b) && !strcmp(a, b);
}


x86 assembly (clang, -O0):
<string_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x11(%rbp)
jne    1173 <string_compare+0x53>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_compare>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rbx
jne    1159 <string_compare+0x39>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @string_compare(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 = call i64 @strlen(i8* %5)
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = icmp eq i64 %6, %8
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = call i32 @strcmp(i8* %11, i8* %12)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br label %16
16: ; preds = %10, %2
%17 = phi i1 [ false, %2 ], [ %15, %10 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @string_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void callbackFunc(int fd, void *service_data, const char *parameters) {
  printf("inside the callback function, invoked by fd %d\n", fd);
  printf("received parameters: \n\t%s\n", parameters);
}


x86 assembly (clang, -O0):
<callbackFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callbackFunc>:
push   %rbx
mov    %rdx,%rbx
mov    %edi,%esi
lea    0xee3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf05(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"inside the callback function, invoked by fd %d\0A\00"
@.str.1 = [27 x i8] c"received parameters: \0A\09%s\0A\00"
define void @callbackFunc(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i8*, i8** %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"inside the callback function, invoked by fd %d\0A\00"
@.str.1 = [27 x i8] c"received parameters: \0A\09%s\0A\00"
define void @callbackFunc(i32 %0, i8* nocapture readnone %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret void
}
void gtk_window_begin_resize_drag() {}


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

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

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

LLVM IR (-O2):
define void @gtk_window_begin_resize_drag() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ countSort(long long *, long long, long long);
long long getMax(long long *, long long);
void radixsort(long long int arr[], long long int n) {
  long long int m = getMax(arr, n), exp;
  for (exp = 1; (m / exp) > 0; exp = exp * 10) {
    countSort(arr, n, exp);
  }
}


x86 assembly (clang, -O0):
<radixsort>:
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   1040 <getMax@plt>
mov    %rax,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cqto
idivq  -0x20(%rbp)
cmp    $0x0,%rax
jle    117c <radixsort+0x5c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <countSort@plt>
imul   $0xa,-0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1149 <radixsort+0x29>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radixsort>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <getMax@plt>
test   %rax,%rax
jle    118a <radixsort+0x6a>
mov    %rax,%r12
mov    $0x1,%ebx
jmp    115d <radixsort+0x3d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rax
cqto
idiv   %rbx
test   %rax,%rax
jle    118a <radixsort+0x6a>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <countSort@plt>
add    %rbx,%rbx
lea    (%rbx,%rbx,4),%rbx
mov    %r12,%rax
or     %rbx,%rax
shr    $0x20,%rax
jne    1150 <radixsort+0x30>
mov    %r12d,%eax
xor    %edx,%edx
div    %ebx
test   %rax,%rax
jg     115d <radixsort+0x3d>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @radixsort(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%7 = load i64*, i64** %3
%8 = load i64, i64* %4
%9 = call i64 @getMax(i64* %7, i64 %8)
store i64 %9, i64* %5
store i64 1, i64* %6
br label %10
10: ; preds = %20, %2
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = sdiv i64 %11, %12
%14 = icmp sgt i64 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %10
%16 = load i64*, i64** %3
%17 = load i64, i64* %4
%18 = load i64, i64* %6
%19 = call i32 @countSort(i64* %16, i64 %17, i64 %18)
br label %20
20: ; preds = %15
%21 = load i64, i64* %6
%22 = mul nsw i64 %21, 10
store i64 %22, i64* %6
br label %10
23: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @radixsort(i64* %0, i64 %1) {
%3 = tail call i64 @getMax(i64* %0, i64 %1)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %2, %5
%6 = phi i64 [ %8, %5 ], [ 1, %2 ]
%7 = tail call i32 @countSort(i64* %0, i64 %1, i64 %6)
%8 = mul nsw i64 %6, 10
%9 = sdiv i64 %3, %8
%10 = icmp sgt i64 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %5, %2
ret void
}
int isPalindrome(int n) {
  int rev = 0, digit = 0, _n = n;
  while (_n > 0 && n > 10) {
    digit = _n % 10;
    rev = rev * 10 + digit;
    _n = _n / 10;
  }
  return rev == n ? 1 : 0;
}


x86 assembly (clang, -O0):
<isPalindrome>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jle    1134 <isPalindrome+0x34>
cmpl   $0xa,-0x4(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1144 <isPalindrome+0x44>
jmp    116f <isPalindrome+0x6f>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
imul   $0xa,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    111b <isPalindrome+0x1b>
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPalindrome>:
xor    %edx,%edx
cmp    $0xb,%edi
jl     1143 <isPalindrome+0x43>
xor    %edx,%edx
mov    $0xcccccccd,%r8d
mov    %edi,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rdx,%rdx,4),%r9d
mov    %ecx,%esi
imul   %r8,%rsi
shr    $0x23,%rsi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%eax
mov    %ecx,%edx
sub    %eax,%edx
lea    (%rdx,%r9,2),%edx
cmp    $0x9,%ecx
mov    %esi,%ecx
ja     1120 <isPalindrome+0x20>
xor    %eax,%eax
cmp    %edi,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @isPalindrome(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%6 = load i32, i32* %2
store i32 %6, i32* %5
br label %7
7: ; preds = %15, %1
%8 = load i32, i32* %5
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 10
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ false, %7 ], [ %12, %10 ]
br i1 %14, label %15, label %24
15: ; preds = %13
%16 = load i32, i32* %5
%17 = srem i32 %16, 10
store i32 %17, i32* %4
%18 = load i32, i32* %3
%19 = mul nsw i32 %18, 10
%20 = load i32, i32* %4
%21 = add nsw i32 %19, %20
store i32 %21, i32* %3
%22 = load i32, i32* %5
%23 = sdiv i32 %22, 10
store i32 %23, i32* %5
br label %7
24: ; preds = %13
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = icmp eq i32 %25, %26
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 1, i32 0
ret i32 %29
}

LLVM IR (-O2):
define i32 @isPalindrome(i32 %0) {
%2 = icmp sgt i32 %0, 10
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ %0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 0, %1 ]
%6 = urem i32 %4, 10
%7 = mul nsw i32 %5, 10
%8 = add nsw i32 %6, %7
%9 = udiv i32 %4, 10
%10 = icmp ugt i32 %4, 9
br i1 %10, label %3, label %11
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
%13 = icmp eq i32 %12, %0
%14 = zext i1 %13 to i32
ret i32 %14
}
/* Variables and functions */
int realtek_mst_i2c_spi_wait_command_done(int, int, int, int /*<<< orphan*/,
                                          int);
int realtek_mst_i2c_spi_write_register(int, int, int);
int realtek_mst_i2c_execute_write(int fd) {
  int ret = realtek_mst_i2c_spi_write_register(fd, 0x6F, 0xA0);
  ret |= realtek_mst_i2c_spi_wait_command_done(fd, 0x6F, 0x20, 0, 1);
  return ret;
}


x86 assembly (clang, -O0):
<realtek_mst_i2c_execute_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x6f,%esi
mov    $0xa0,%edx
call   1040 <realtek_mst_i2c_spi_write_register@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x6f,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1030 <realtek_mst_i2c_spi_wait_command_done@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realtek_mst_i2c_execute_write>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x6f,%esi
mov    $0xa0,%edx
call   1040 <realtek_mst_i2c_spi_write_register@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x6f,%esi
mov    $0x20,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1030 <realtek_mst_i2c_spi_wait_command_done@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @realtek_mst_i2c_execute_write(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @realtek_mst_i2c_spi_write_register(i32 %4, i32 111, i32 160)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = call i32 @realtek_mst_i2c_spi_wait_command_done(i32 %6, i32 111, i32 32, i32 0, i32 1)
%8 = load i32, i32* %3
%9 = or i32 %8, %7
store i32 %9, i32* %3
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @realtek_mst_i2c_execute_write(i32 %0) {
%2 = tail call i32 @realtek_mst_i2c_spi_write_register(i32 %0, i32 111, i32 160)
%3 = tail call i32 @realtek_mst_i2c_spi_wait_command_done(i32 %0, i32 111, i32 32, i32 0, i32 1)
%4 = or i32 %3, %2
ret i32 %4
}
/* Type definitions */
struct tcb {
  int dummy;
};

/* Variables and functions */
int do_eventfd(struct tcb *, int);
int sys_eventfd2(struct tcb *tcp) { return do_eventfd(tcp, 1); }


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

x86 assembly (clang, -O2):
<sys_eventfd2>:
mov    $0x1,%esi
jmp    1030 <do_eventfd@plt>

LLVM IR (-O0):
%struct.tcb = type { i32 }
define i32 @sys_eventfd2(%struct.tcb* %0) {
%2 = alloca %struct.tcb*
store %struct.tcb* %0, %struct.tcb** %2
%3 = load %struct.tcb*, %struct.tcb** %2
%4 = call i32 @do_eventfd(%struct.tcb* %3, i32 1)
ret i32 %4
}

LLVM IR (-O2):
%struct.tcb = type { i32 }
define i32 @sys_eventfd2(%struct.tcb* %0) {
%2 = tail call i32 @do_eventfd(%struct.tcb* %0, i32 1)
ret i32 %2
}
int __attribute__((no, noclone)) data2(void) { return 20; }


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

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

LLVM IR (-O0):
define i32 @data2() {
ret i32 20
}

LLVM IR (-O2):
define i32 @data2() {
ret i32 20
}
/* Variables and functions */
int /*<<< orphan*/ sysinit();
int main(int argc, char **argv) {
  sysinit();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @sysinit()
ret i32 0
}
/* Variables and functions */
int O_CREAT;
int O_RDWR;
int open(char const *, int, int);
int /*<<< orphan*/ perror(char *);
int log_init(const char *filename) {
  int fd;
  fd = open(filename, O_CREAT | O_RDWR, 0644);
  if (fd < 0)
    perror("open: ");
  return (fd);
}


x86 assembly (clang, -O0):
<log_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    0x2ea0(%rip),%rax
or     (%rax),%esi
mov    $0x1a4,%edx
call   1030 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1165 <log_init+0x45>
lea    0xea0(%rip),%rdi
call   1040 <perror@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_init>:
push   %rbx
mov    0x2ed0(%rip),%rax
mov    0x2eb1(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    $0x1a4,%edx
call   1030 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1147 <log_init+0x27>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xeb2(%rip),%rdi
call   1040 <perror@plt>
jmp    1143 <log_init+0x23>

LLVM IR (-O0):
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@.str = [7 x i8] c"open: \00"
define i32 @log_init(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_CREAT
%6 = load i32, i32* @O_RDWR
%7 = or i32 %5, %6
%8 = call i32 @open(i8* %4, i32 %7, i32 420)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %1
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@.str = [7 x i8] c"open: \00"
define i32 @log_init(i8* nocapture %0) {
%2 = load i32, i32* @O_CREAT
%3 = load i32, i32* @O_RDWR
%4 = or i32 %3, %2
%5 = tail call i32 @open(i8* %0, i32 %4, i32 420)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret i32 %5
}
/* Type definitions */
struct passwd {
  scalar_t__ pw_uid;
};

/* Variables and functions */
int /*<<< orphan*/ endpwent();
struct passwd *getpwnam(char *);
int Privsep_GetUser(char *name) {
  int os_uid = -1;
  struct passwd *pw;
  pw = getpwnam(name);
  if (pw == NULL)
    return (-1);
  os_uid = (int)pw->pw_uid;
  endpwent();
  return (os_uid);
}


x86 assembly (clang, -O0):
<Privsep_GetUser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <getpwnam@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1157 <Privsep_GetUser+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    116e <Privsep_GetUser+0x4e>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <endpwent@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Privsep_GetUser>:
push   %rbx
call   1030 <getpwnam@plt>
test   %rax,%rax
je     1136 <Privsep_GetUser+0x16>
mov    (%rax),%ebx
xor    %eax,%eax
call   1040 <endpwent@plt>
jmp    113b <Privsep_GetUser+0x1b>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.passwd = type { i64 }
define i32 @Privsep_GetUser(i8* nocapture %0) {
%2 = tail call %struct.passwd* @getpwnam(i8* %0)
%3 = icmp eq %struct.passwd* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = getelementptr inbounds %struct.passwd, %struct.passwd* %2, i64 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = tail call i32 (...) @endpwent()
br label %9
9: ; preds = %1, %4
%10 = phi i32 [ %7, %4 ], [ -1, %1 ]
ret i32 %10
}
void f2(void) {
  _Atomic int a = 0, b[2] = {1, 2};
#pragma omp target defaultmap(tofrom : scalar)
  a++;
#pragma omp target
  b[0]++;
}


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

x86 assembly (clang, -O2):
<f2>:
movl   $0x0,-0xc(%rsp)
movabs $0x200000001,%rax
mov    %rax,-0x8(%rsp)
lock addl $0x1,-0xc(%rsp)
lock addl $0x1,-0x8(%rsp)
ret

LLVM IR (-O0):
define void @f2() {
%1 = alloca i32
%2 = alloca [2 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32 1, i32* %3
%4 = getelementptr inbounds i32, i32* %3, i64 1
store i32 2, i32* %4
%5 = atomicrmw add i32* %1, i32 1 seq_cst
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%7 = atomicrmw add i32* %6, i32 1 seq_cst
ret void
}

LLVM IR (-O2):
define void @f2() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast [2 x i32]* %2 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32 1, i32* %5
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
store i32 2, i32* %6
%7 = atomicrmw add i32* %1, i32 1 seq_cst
%8 = atomicrmw add i32* %5, i32 1 seq_cst
ret void
}
/* Variables and functions */
scalar_t__ close(int);
int close_pipe(int handles[2]) {
  int res = 0;
  if (close(handles[0]) < 0) {
    res = -1;
  }
  if (close(handles[1]) < 0) {
    res = -1;
  }
  return res;
}


x86 assembly (clang, -O0):
<close_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <close@plt>
cmp    $0x0,%rax
jge    113f <close_pipe+0x2f>
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <close@plt>
cmp    $0x0,%rax
jge    115c <close_pipe+0x4c>
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_pipe>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%edi
call   1030 <close@plt>
mov    %rax,%rbx
sar    $0x3f,%rbx
mov    0x4(%r14),%edi
call   1030 <close@plt>
test   %rax,%rax
mov    $0xffffffff,%eax
cmovns %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @close_pipe(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i64 @close(i32 %2)
%4 = ashr i64 %3, 63
%5 = trunc i64 %4 to i32
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = tail call i64 @close(i32 %7)
%9 = icmp slt i64 %8, 0
%10 = select i1 %9, i32 -1, i32 %5
ret i32 %10
}
int test_imm_E0uint32_mem(unsigned int *val) {
  return ((*val) & (0xE0 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E0uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 224
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ h(int, int);
int /*<<< orphan*/ use_pointer(int *);
int g1(int a, int b) {
  int i;
  for (i = 0; i <= b; i++)
    use_pointer(&a);
  h(a, b);
}


x86 assembly (clang, -O0):
<g1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1158 <g1+0x38>
lea    -0x8(%rbp),%rdi
call   1040 <use_pointer@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1135 <g1+0x15>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <h@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g1>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %edi,0xc(%rsp)
test   %esi,%esi
js     1151 <g1+0x31>
lea    0x1(%r14),%ebp
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <use_pointer@plt>
add    $0xffffffff,%ebp
jne    1140 <g1+0x20>
mov    0xc(%rsp),%edi
mov    %r14d,%esi
call   1030 <h@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @g1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %13, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = call i32 @use_pointer(i32* %4)
br label %13
13: ; preds = %11
%14 = load i32, i32* %6
%15 = add nsw i32 %14, 1
store i32 %15, i32* %6
br label %7
16: ; preds = %7
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 @h(i32 %17, i32 %18)
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @g1(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = icmp slt i32 %1, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ 0, %2 ]
%7 = call i32 @use_pointer(i32* %3)
%8 = add nuw i32 %6, 1
%9 = icmp eq i32 %6, %1
br i1 %9, label %10, label %5
10: ; preds = %5
%11 = load i32, i32* %3
br label %12
12: ; preds = %10, %2
%13 = phi i32 [ %11, %10 ], [ %0, %2 ]
%14 = call i32 @h(i32 %13, i32 %1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/
_test_consulta_debe_permitir_consultar_un_elemento_sin_sacarlo();
int /*<<< orphan*/ _test_pone_y_saca_deben_permitir_poner_y_sacar_elementos();
int /*<<< orphan*/ _test_vacia_debe_indicar_si_la_pila_esta_vacia();
void colad_tests() {
  _test_vacia_debe_indicar_si_la_pila_esta_vacia();
  _test_pone_y_saca_deben_permitir_poner_y_sacar_elementos();
  _test_consulta_debe_permitir_consultar_un_elemento_sin_sacarlo();
}


x86 assembly (clang, -O0):
<colad_tests>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <_test_vacia_debe_indicar_si_la_pila_esta_vacia@plt>
mov    $0x0,%al
call   1030 <_test_pone_y_saca_deben_permitir_poner_y_sacar_elementos@plt>
mov    $0x0,%al
call   1050 <_test_consulta_debe_permitir_consultar_un_elemento_sin_sacarlo@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<colad_tests>:
push   %rax
xor    %eax,%eax
call   1040 <_test_vacia_debe_indicar_si_la_pila_esta_vacia@plt>
xor    %eax,%eax
call   1030 <_test_pone_y_saca_deben_permitir_poner_y_sacar_elementos@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <_test_consulta_debe_permitir_consultar_un_elemento_sin_sacarlo@plt>

LLVM IR (-O0):
define void @colad_tests() {
%1 = call i32 (...) @_test_vacia_debe_indicar_si_la_pila_esta_vacia()
%2 = call i32 (...) @_test_pone_y_saca_deben_permitir_poner_y_sacar_elementos()
%3 = call i32 (...) @_test_consulta_debe_permitir_consultar_un_elemento_sin_sacarlo()
ret void
}

LLVM IR (-O2):
define void @colad_tests() {
%1 = tail call i32 (...) @_test_vacia_debe_indicar_si_la_pila_esta_vacia()
%2 = tail call i32 (...) @_test_pone_y_saca_deben_permitir_poner_y_sacar_elementos()
%3 = tail call i32 (...) @_test_consulta_debe_permitir_consultar_un_elemento_sin_sacarlo()
ret void
}
int execv(char *s, int wait) {
  int pid;
  asm volatile("int $0x30" : "=a"(pid) : "a"(4), "b"(s), "c"(wait));
  return pid;
}


x86 assembly (clang, -O0):
<execv>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rbx
mov    -0x14(%rbp),%ecx
mov    $0x4,%eax
int    $0x30
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<execv>:
push   %rbx
mov    %esi,%ecx
mov    %rdi,%rbx
mov    $0x4,%eax
int    $0x30
pop    %rbx
ret

LLVM IR (-O0):
define i32 @execv(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 asm sideeffect "int $$0x30", "={ax},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 4, i8* %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @execv(i8* %0, i32 %1) {
%3 = tail call i32 asm sideeffect "int $$0x30", "={ax},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 4, i8* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
scalar_t__ __NR_write;
void *malloc(int);
int /*<<< orphan*/ syscall(scalar_t__, int, char *, int);
int main(void) {
  int *pi = malloc(sizeof(int));
  char **pc = malloc(sizeof(char *));
  syscall(pi[0] + __NR_write, pi[0], pc[0], pi[0] + 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq (%rax),%rdi
mov    0x2e8f(%rip),%rax
add    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
call   1030 <syscall@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%rdi
call   1030 <syscall@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__NR_write = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8**
store i32 0, i32* %1
%4 = call i8* @malloc(i32 4)
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %2
%6 = call i8* @malloc(i32 8)
%7 = bitcast i8* %6 to i8**
store i8** %7, i8*** %3
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = sext i32 %10 to i64
%12 = load i64, i64* @__NR_write
%13 = add nsw i64 %11, %12
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 0
%16 = load i32, i32* %15
%17 = load i8**, i8*** %3
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i64 0
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1
%24 = call i32 @syscall(i64 %13, i32 %16, i8* %19, i32 %23)
ret i32 0
}

LLVM IR (-O2):
@__NR_write = global i64 0
define i32 @main() {
%1 = load i64, i64* @__NR_write
%2 = tail call i32 @syscall(i64 %1, i32 undef, i8* undef, i32 undef)
ret i32 0
}
/* Type definitions */
struct hdr_histogram {
  int dummy;
};
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
scalar_t__ lowest_equivalent_value(struct hdr_histogram const *,
                                   int /*<<< orphan*/);
bool hdr_values_are_equivalent(const struct hdr_histogram *h, int64_t a,
                               int64_t b) {
  return lowest_equivalent_value(h, a) == lowest_equivalent_value(h, b);
}


x86 assembly (clang, -O0):
<hdr_values_are_equivalent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <lowest_equivalent_value@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <lowest_equivalent_value@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdr_values_are_equivalent>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rdi,%rbx
call   1030 <lowest_equivalent_value@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <lowest_equivalent_value@plt>
xor    %ecx,%ecx
cmp    %rax,%rbp
sete   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.hdr_histogram = type { i32 }
define i32 @hdr_values_are_equivalent(%struct.hdr_histogram* %0, i32 %1, i32 %2) {
%4 = alloca %struct.hdr_histogram*
%5 = alloca i32
%6 = alloca i32
store %struct.hdr_histogram* %0, %struct.hdr_histogram** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.hdr_histogram*, %struct.hdr_histogram** %4
%8 = load i32, i32* %5
%9 = call i64 @lowest_equivalent_value(%struct.hdr_histogram* %7, i32 %8)
%10 = load %struct.hdr_histogram*, %struct.hdr_histogram** %4
%11 = load i32, i32* %6
%12 = call i64 @lowest_equivalent_value(%struct.hdr_histogram* %10, i32 %11)
%13 = icmp eq i64 %9, %12
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
%struct.hdr_histogram = type { i32 }
define i32 @hdr_values_are_equivalent(%struct.hdr_histogram* %0, i32 %1, i32 %2) {
%4 = tail call i64 @lowest_equivalent_value(%struct.hdr_histogram* %0, i32 %1)
%5 = tail call i64 @lowest_equivalent_value(%struct.hdr_histogram* %0, i32 %2)
%6 = icmp eq i64 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}