xunge/DecIR huggingface dataset:
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fileno(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ tcgetattr(int /*<<< orphan*/, struct termios *);
int save_term(struct termios *termios_p) {
  if (tcgetattr(fileno(stdin), termios_p) != 0) {
    fprintf(stderr, "Failed to save terminal settings");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<save_term>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1040 <fileno@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1050 <tcgetattr@plt>
cmp    $0x0,%rax
je     1180 <save_term+0x50>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe91(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1187 <save_term+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_term>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
call   1040 <fileno@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <tcgetattr@plt>
test   %rax,%rax
je     116d <save_term+0x3d>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@stdin = global i32 0
@stderr = global i32 0
@.str = [33 x i8] c"Failed to save terminal settings\00"
define i32 @save_term(%struct.termios* %0) {
%2 = alloca i32
%3 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %3
%4 = load i32, i32* @stdin
%5 = call i32 @fileno(i32 %4)
%6 = load %struct.termios*, %struct.termios** %3
%7 = call i64 @tcgetattr(i32 %5, %struct.termios* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@stdin = global i32 0
@stderr = global i32 0
@.str = [33 x i8] c"Failed to save terminal settings\00"
define i32 @save_term(%struct.termios* %0) {
%2 = load i32, i32* @stdin
%3 = tail call i32 @fileno(i32 %2)
%4 = tail call i64 @tcgetattr(i32 %3, %struct.termios* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %1, %6
%10 = phi i32 [ -1, %6 ], [ 0, %1 ]
ret i32 %10
}
int mik_isupper(int c) { return (c >= 'A' && c <= 'Z'); }


x86 assembly (clang, -O0):
<mik_isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <mik_isupper+0x20>
cmpl   $0x5a,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mik_isupper>:
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @mik_isupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 65
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 90
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @mik_isupper(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
long long pow(int, double);
long long int cubrt(long long int n) {
  long long int val;
  val = pow(3 * n, 0.333333333333);
  return val;
}


x86 assembly (clang, -O0):
<cubrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
imul   $0x3,-0x8(%rbp),%rax
mov    %eax,%edi
movsd  0xed5(%rip),%xmm0
call   1030 <pow@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cubrt>:
lea    (%rdi,%rdi,2),%edi
movsd  0xee5(%rip),%xmm0
jmp    1030 <pow@plt>

LLVM IR (-O0):
define i64 @cubrt(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = mul nsw i64 3, %4
%6 = trunc i64 %5 to i32
%7 = call i64 @pow(i32 %6, double 0x3FD5555555553DE1)
store i64 %7, i64* %3
%8 = load i64, i64* %3
ret i64 %8
}

LLVM IR (-O2):
define i64 @cubrt(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = mul i32 %2, 3
%4 = tail call i64 @pow(i32 %3, double 0x3FD5555555553DE1)
ret i64 %4
}
/* Variables and functions */
int I2C_Write(int, int, unsigned char *);
int STC3115_WriteWord(int RegAddress, int Value) {
  int res;
  unsigned char data[2];
  data[0] = Value & 0xff;
  data[1] = (Value >> 8) & 0xff;
  res = I2C_Write(2, RegAddress, data);
  return (res);
}


x86 assembly (clang, -O0):
<STC3115_WriteWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %al,-0xe(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0xd(%rbp)
mov    -0x4(%rbp),%esi
lea    -0xe(%rbp),%rdx
mov    $0x2,%edi
call   1030 <I2C_Write@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STC3115_WriteWord>:
push   %rax
mov    %edi,%eax
mov    %si,0x6(%rsp)
lea    0x6(%rsp),%rdx
mov    $0x2,%edi
mov    %eax,%esi
call   1030 <I2C_Write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @STC3115_WriteWord(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [2 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = and i32 %7, 255
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
store i8 %9, i8* %10
%11 = load i32, i32* %4
%12 = ashr i32 %11, 8
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
store i8 %14, i8* %15
%16 = load i32, i32* %3
%17 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%18 = call i32 @I2C_Write(i32 2, i32 %16, i8* %17)
store i32 %18, i32* %5
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
define i32 @STC3115_WriteWord(i32 %0, i32 %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = trunc i32 %1 to i8
store i8 %5, i8* %4
%6 = lshr i32 %1, 8
%7 = trunc i32 %6 to i8
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 %7, i8* %8
%9 = call i32 @I2C_Write(i32 2, i32 %0, i8* %4)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cWriteByte(unsigned char, unsigned char);
void SensorSetReg_OV7670(unsigned short uAddr, unsigned short uVal) {
  VIM_SIF_I2cWriteByte((unsigned char)uAddr, (unsigned char)uVal);
}


x86 assembly (clang, -O0):
<SensorSetReg_OV7670>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
mov    %al,%cl
mov    -0x4(%rbp),%ax
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetReg_OV7670>:
movzbl %dil,%edi
movzbl %sil,%esi
jmp    1030 <VIM_SIF_I2cWriteByte@plt>

LLVM IR (-O0):
define void @SensorSetReg_OV7670(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = trunc i16 %5 to i8
%7 = load i16, i16* %4
%8 = trunc i16 %7 to i8
%9 = call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %6, i8 zeroext %8)
ret void
}

LLVM IR (-O2):
define void @SensorSetReg_OV7670(i16 zeroext %0, i16 zeroext %1) {
%3 = trunc i16 %0 to i8
%4 = trunc i16 %1 to i8
%5 = tail call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %3, i8 zeroext %4)
ret void
}
/* Variables and functions */
scalar_t__ read(int, char *, int);
int /*<<< orphan*/ write(int, char *, int);
void put_file(int fd) {
  char buf;
  while (read(fd, &buf, 1))
    write(1, &buf, 1);
}


x86 assembly (clang, -O0):
<put_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0x0,%rax
je     115b <put_file+0x3b>
mov    $0x1,%edx
lea    -0x5(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    112b <put_file+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_file>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
test   %rax,%rax
je     1166 <put_file+0x46>
lea    0x7(%rsp),%rbx
xchg   %ax,%ax
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
test   %rax,%rax
jne    1140 <put_file+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @put_file(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %2
%6 = call i64 @read(i32 %5, i8* %3, i32 1)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = call i32 @write(i32 1, i8* %3, i32 1)
br label %4
10: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @put_file(i32 %0) {
%2 = alloca i8
%3 = call i64 @read(i32 %0, i8* %2, i32 1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1, %5
%6 = call i32 @write(i32 1, i8* %2, i32 1)
%7 = call i64 @read(i32 %0, i8* %2, i32 1)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5, %1
ret void
}
unsigned long get_trace_buf_size(void) { return 0; }


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

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

LLVM IR (-O0):
define i64 @get_trace_buf_size() {
ret i64 0
}

LLVM IR (-O2):
define i64 @get_trace_buf_size() {
ret i64 0
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t PWMIntStatus(uint32_t ui32Base, bool bMasked) {
  ;
  if (bMasked == 1) {
    return ((*((volatile unsigned long *)(ui32Base + 0x0000001C))));
  } else {
    return ((*((volatile unsigned long *)(ui32Base + 0x00000018))));
  }
}


x86 assembly (clang, -O0):
<PWMIntStatus>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1126 <PWMIntStatus+0x26>
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1132 <PWMIntStatus+0x32>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMIntStatus>:
mov    %rdi,-0x8(%rsp)
xor    %eax,%eax
cmp    $0x1,%esi
sete   %al
mov    -0x8(%rsp),%rcx
mov    0x18(%rcx,%rax,4),%rax
ret

LLVM IR (-O0):
define i64 @PWMIntStatus(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
store volatile i64 %0, i64* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load volatile i64, i64* %4
%10 = add i64 %9, 28
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
store i64 %12, i64* %3
br label %18
13: ; preds = %2
%14 = load volatile i64, i64* %4
%15 = add i64 %14, 24
%16 = inttoptr i64 %15 to i64*
%17 = load volatile i64, i64* %16
store i64 %17, i64* %3
br label %18
18: ; preds = %13, %8
%19 = load i64, i64* %3
ret i64 %19
}

LLVM IR (-O2):
define i64 @PWMIntStatus(i64 %0, i32 %1) {
%3 = alloca i64
store volatile i64 %0, i64* %3
%4 = icmp eq i32 %1, 1
%5 = load volatile i64, i64* %3
%6 = select i1 %4, i64 28, i64 24
%7 = add i64 %5, %6
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
ret i64 %9
}
void CpuInit(void) {
  extern void P1020ElbcInit();
  P1020ElbcInit();
  return;
}


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

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

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

LLVM IR (-O2):
define void @CpuInit() {
tail call void (...) @P1020ElbcInit()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int x;
  x = 1;
  printf("%d\n", x);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ phasta(int, char **);
int main(int argc, char *argv[]) {
  phasta(argc, argv);
  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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <phasta@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <phasta@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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @phasta(i32 %6, i8** %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @phasta(i32 %0, i8** %1)
ret i32 0
}
/* Variables and functions */
char *make_string_copy_len(char const *, int);
char *make_string_copy_between_ptrs(const char *start, const char *end) {
  return make_string_copy_len(start, end - start);
}


x86 assembly (clang, -O0):
<make_string_copy_between_ptrs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
call   1030 <make_string_copy_len@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_string_copy_between_ptrs>:
sub    %edi,%esi
jmp    1030 <make_string_copy_len@plt>

LLVM IR (-O0):
define i8* @make_string_copy_between_ptrs(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 = load i8*, i8** %3
%8 = ptrtoint i8* %6 to i64
%9 = ptrtoint i8* %7 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
%12 = call i8* @make_string_copy_len(i8* %5, i32 %11)
ret i8* %12
}

LLVM IR (-O2):
define i8* @make_string_copy_between_ptrs(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
%7 = tail call i8* @make_string_copy_len(i8* %0, i32 %6)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern char *shmem_nodename(void) { printf("\nOpenSHMEM Analyzer\n"); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"\0AOpenSHMEM Analyzer\0A\00"
define i8* @shmem_nodename() {
%1 = alloca i8*
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = load i8*, i8** %1
ret i8* %3
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define noalias i8* @shmem_nodename() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo(int *);
int main() {
  int b = 1;
  int a = foo(&b);
  if (a != -1 || b != (1 + 5 - 15))
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <foo@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1166 <main+0x36>
cmpl   $0xfffffff7,-0x8(%rbp)
je     116d <main+0x3d>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1040 <foo@plt>
cmp    $0xffffffff,%eax
jne    1156 <main+0x26>
cmpl   $0xfffffff7,0x4(%rsp)
jne    1156 <main+0x26>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%4 = call i32 @foo(i32* %2)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, -1
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, -9
br i1 %9, label %10, label %12
10: ; preds = %7, %0
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %7
%13 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%3 = call i32 @foo(i32* %1)
%4 = icmp ne i32 %3, -1
%5 = load i32, i32* %1
%6 = icmp ne i32 %5, -9
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %0
%11 = call i32 @exit(i32 0)
unreachable
}
unsigned int enable_4G(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @enable_4G() {
ret i32 0
}
/* Variables and functions */
char tolower(char);
int getDigit(char c) {
  c = tolower(c);
  if ('0' <= c && c <= '9') {
    return (c - '0');
  }
  return -1;
}


x86 assembly (clang, -O0):
<getDigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <tolower@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     1157 <getDigit+0x47>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1157 <getDigit+0x47>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    115e <getDigit+0x4e>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDigit>:
push   %rax
call   1030 <tolower@plt>
movsbl %al,%ecx
add    $0xd0,%al
add    $0xffffffd0,%ecx
cmp    $0xa,%al
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @getDigit(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call signext i8 @tolower(i8 signext %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp sle i32 48, %7
br i1 %8, label %9, label %17
9: ; preds = %1
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 57
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 48
store i32 %16, i32* %2
br label %18
17: ; preds = %9, %1
store i32 -1, i32* %2
br label %18
18: ; preds = %17, %13
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @getDigit(i8 signext %0) {
%2 = tail call signext i8 @tolower(i8 signext %0)
%3 = add i8 %2, -48
%4 = icmp ult i8 %3, 10
%5 = sext i8 %2 to i32
%6 = add nsw i32 %5, -48
%7 = select i1 %4, i32 %6, i32 -1
ret i32 %7
}
void gtk_image_set_from_pixmap() {}


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

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

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

LLVM IR (-O2):
define void @gtk_image_set_from_pixmap() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ testByte();
int /*<<< orphan*/ testInt();
int /*<<< orphan*/ testLong();
int /*<<< orphan*/ testShort();
int main() {
  testLong();
  testInt();
  testShort();
  testByte();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <testLong@plt>
mov    $0x0,%al
call   1040 <testInt@plt>
mov    $0x0,%al
call   1050 <testShort@plt>
mov    $0x0,%al
call   1060 <testByte@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <testLong@plt>
xor    %eax,%eax
call   1040 <testInt@plt>
xor    %eax,%eax
call   1050 <testShort@plt>
xor    %eax,%eax
call   1060 <testByte@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @testLong()
%2 = call i32 (...) @testInt()
%3 = call i32 (...) @testShort()
%4 = call i32 (...) @testByte()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @testLong()
%2 = tail call i32 (...) @testInt()
%3 = tail call i32 (...) @testShort()
%4 = tail call i32 (...) @testByte()
ret i32 0
}
int dysize(int y) {
  y += 1900;
  if ((y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0))
    return 366;
  return 365;
}


x86 assembly (clang, -O0):
<dysize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x76c,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115a <dysize+0x5a>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114e <dysize+0x4e>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115a <dysize+0x5a>
movl   $0x16e,-0x4(%rbp)
jmp    1161 <dysize+0x61>
movl   $0x16d,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dysize>:
test   $0x3,%dil
jne    1149 <dysize+0x49>
add    $0x76c,%edi
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
ror    $0x2,%ecx
mov    $0x16e,%eax
cmp    $0x28f5c28,%ecx
ja     114e <dysize+0x4e>
movslq %edi,%rcx
imul   $0x51eb851f,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x27,%rcx
add    %edx,%ecx
imul   $0x190,%ecx,%ecx
sub    %ecx,%edi
je     114e <dysize+0x4e>
mov    $0x16d,%eax
ret

LLVM IR (-O0):
define i32 @dysize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1900
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = srem i32 %6, 4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %1
%10 = load i32, i32* %3
%11 = srem i32 %10, 100
%12 = icmp ne i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = load i32, i32* %3
%15 = srem i32 %14, 400
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13, %9
store i32 366, i32* %2
br label %19
18: ; preds = %13, %1
store i32 365, i32* %2
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @dysize(i32 %0) {
%2 = add nsw i32 %0, 1900
%3 = and i32 %0, 3
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = srem i32 %2, 100
%7 = icmp ne i32 %6, 0
%8 = srem i32 %2, 400
%9 = icmp eq i32 %8, 0
%10 = or i1 %7, %9
br i1 %10, label %12, label %11
11: ; preds = %5, %1
br label %12
12: ; preds = %5, %11
%13 = phi i32 [ 365, %11 ], [ 366, %5 ]
ret i32 %13
}
/* Type definitions */
struct UPnPService {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, unsigned short);
void RNDResponseSink_RenderingControl_GetGreenVideoGain(
    struct UPnPService *Service, int ErrorCode, void *User,
    unsigned short CurrentGreenVideoGain) {
  printf("RND Invoke Response: "
         "RenderingControl/GetGreenVideoGain[ErrorCode:%d](%u)\r\n",
         ErrorCode, CurrentGreenVideoGain);
}


x86 assembly (clang, -O0):
<RNDResponseSink_RenderingControl_GetGreenVideoGain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cx,%ax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
mov    -0xc(%rbp),%esi
lea    0xecc(%rip),%rdi
movzwl -0x1a(%rbp),%edx
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RNDResponseSink_RenderingControl_GetGreenVideoGain>:
lea    0xee9(%rip),%rdi
mov    %ecx,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.UPnPService = type { i32 }
@.str = [76 x i8] c"RND Invoke Response: RenderingControl/GetGreenVideoGain[ErrorCode:%d](%u)\0D\0A\00"
define void @RNDResponseSink_RenderingControl_GetGreenVideoGain(%struct.UPnPService* %0, i32 %1, i8* %2, i16 zeroext %3) {
%5 = alloca %struct.UPnPService*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i16
store %struct.UPnPService* %0, %struct.UPnPService** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i16 %3, i16* %8
%9 = load i32, i32* %6
%10 = load i16, i16* %8
%11 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i32 %9, i16 zeroext %10)
ret void
}

LLVM IR (-O2):
%struct.UPnPService = type { i32 }
@.str = [76 x i8] c"RND Invoke Response: RenderingControl/GetGreenVideoGain[ErrorCode:%d](%u)\0D\0A\00"
define void @RNDResponseSink_RenderingControl_GetGreenVideoGain(%struct.UPnPService* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i16 zeroext %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i32 %1, i16 zeroext %3)
ret void
}
/* Variables and functions */
int strEqual(char *, char *);
int cmphash(void *P1, void *P2) {
  char *f = *(char **)P1;
  char *s = *(char **)P2;
  return strEqual(f, s);
}


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

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

LLVM IR (-O0):
define i32 @cmphash(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
%9 = load i8*, i8** %8
store i8* %9, i8** %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i8**
%12 = load i8*, i8** %11
store i8* %12, i8** %6
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = call i32 @strEqual(i8* %13, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @cmphash(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strEqual(i8* %4, i8* %6)
ret i32 %7
}
void task1(void) {
  char *msg = (char *)0x100;
  msg[0] = 't';
  msg[1] = 'a';
  msg[2] = 's';
  msg[3] = 'k';
  msg[4] = '1';
  msg[5] = '\n';
  msg[6] = 0;
  asm("mov %0, %%ebx; mov $0x01, %%eax; int $0x30" ::"m"(msg));
  while (1)
    ;
  return;
}


x86 assembly (clang, -O0):
<task1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x100,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x74,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x61,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x73,0x2(%rax)
mov    -0x8(%rbp),%rax
movb   $0x6b,0x3(%rax)
mov    -0x8(%rbp),%rax
movb   $0x31,0x4(%rax)
mov    -0x8(%rbp),%rax
movb   $0xa,0x5(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x6(%rax)
mov    -0x8(%rbp),%ebx
mov    $0x1,%eax
int    $0x30
jmp    114e <task1+0x4e>

x86 assembly (clang, -O2):
<task1>:
movq   $0x100,-0x8(%rsp)
movb   $0x74,0x100
74
movb   $0x61,0x101
61
movb   $0x73,0x102
73
movb   $0x6b,0x103
6b
movb   $0x31,0x104
31
movb   $0xa,0x105
0a
movb   $0x0,0x106
mov    -0x8(%rsp),%ebx
mov    $0x1,%eax
int    $0x30
nopl   0x0(%rax)
jmp    1150 <task1+0x50>

LLVM IR (-O0):
define void @task1() {
%1 = alloca i8*
store i8* inttoptr (i64 256 to i8*), i8** %1
%2 = load i8*, i8** %1
%3 = getelementptr inbounds i8, i8* %2, i64 0
store i8 116, i8* %3
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8 97, i8* %5
%6 = load i8*, i8** %1
%7 = getelementptr inbounds i8, i8* %6, i64 2
store i8 115, i8* %7
%8 = load i8*, i8** %1
%9 = getelementptr inbounds i8, i8* %8, i64 3
store i8 107, i8* %9
%10 = load i8*, i8** %1
%11 = getelementptr inbounds i8, i8* %10, i64 4
store i8 49, i8* %11
%12 = load i8*, i8** %1
%13 = getelementptr inbounds i8, i8* %12, i64 5
store i8 10, i8* %13
%14 = load i8*, i8** %1
%15 = getelementptr inbounds i8, i8* %14, i64 6
store i8 0, i8* %15
br label %16
16: ; preds = %0, %16
br label %16
}

LLVM IR (-O2):
define void @task1() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* inttoptr (i64 256 to i8*), i8** %1
store i8 116, i8* inttoptr (i64 256 to i8*)
store i8 97, i8* inttoptr (i64 257 to i8*)
store i8 115, i8* inttoptr (i64 258 to i8*)
store i8 107, i8* inttoptr (i64 259 to i8*)
store i8 49, i8* inttoptr (i64 260 to i8*)
store i8 10, i8* inttoptr (i64 261 to i8*)
store i8 0, i8* inttoptr (i64 262 to i8*)
br label %3
3: ; preds = %3, %0
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
void scan_c(char *result_s, int *printed) {
  char tempch[100];
  read(0, tempch, 1024);
  *result_s = tempch[0];
  (*printed)++;
}


x86 assembly (clang, -O0):
<scan_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rsi
xor    %edi,%edi
mov    $0x400,%edx
call   1030 <read@plt>
mov    -0x80(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_c>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rsi
xor    %edi,%edi
mov    $0x400,%edx
call   1030 <read@plt>
mov    (%rsp),%al
mov    %al,(%rbx)
addl   $0x1,(%r14)
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @scan_c(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [100 x i8]
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%7 = call i32 @read(i32 0, i8* %6, i32 1024)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
store i8 %9, i8* %10
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
store i32 %13, i32* %11
ret void
}

LLVM IR (-O2):
define void @scan_c(i8* nocapture writeonly %0, i32* nocapture %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @read(i32 0, i8* %4, i32 1024)
%6 = load i8, i8* %4
store i8 %6, i8* %0
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ qprintf(char *, void *);
int q_take_semaphore(void *sem) {
  qprintf("*** take_semaphore(%x)\n", sem);
  return 0;
}


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

x86 assembly (clang, -O2):
<q_take_semaphore>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <qprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [24 x i8] c"*** take_semaphore(%x)\0A\00"
define i32 @q_take_semaphore(i8* %0) {
%2 = tail call i32 @qprintf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void destory(void *key, void *val) {
  if (key) {
    free(key);
  }
  if (val) {
    free(val);
  }
}


x86 assembly (clang, -O0):
<destory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1134 <destory+0x24>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x10(%rbp)
je     1148 <destory+0x38>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<destory>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
je     111e <destory+0xe>
call   1030 <free@plt>
test   %rbx,%rbx
je     112c <destory+0x1c>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @destory(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 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @free(i8* %8)
br label %10
10: ; preds = %7, %2
%11 = load i8*, i8** %4
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %4
%15 = call i32 @free(i8* %14)
br label %16
16: ; preds = %13, %10
ret void
}

LLVM IR (-O2):
define void @destory(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @free(i8* %0)
br label %6
6: ; preds = %4, %2
%7 = icmp eq i8* %1, null
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @free(i8* %1)
br label %10
10: ; preds = %8, %6
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
size_t sendMessage(int, char *);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
size_t sendPrepareToSendMsg(int socket, uint32_t size, uint32_t count) {
  char msg[200];
  sprintf(msg, "send;%u;%u", size, count);
  return sendMessage(socket, &msg[0]);
}


x86 assembly (clang, -O0):
<sendPrepareToSendMsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeb8(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0xe0(%rbp),%rsi
call   1030 <sendMessage@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendPrepareToSendMsg>:
push   %r14
push   %rbx
sub    $0xc8,%rsp
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%ebx
lea    0xec9(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <sprintf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <sendMessage@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"send;%u;%u\00"
define i64 @sendPrepareToSendMsg(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [200 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
%12 = load i32, i32* %4
%13 = getelementptr inbounds [200 x i8], [200 x i8]* %7, i64 0, i64 0
%14 = call i64 @sendMessage(i32 %12, i8* %13)
ret i64 %14
}

LLVM IR (-O2):
@.str = [11 x i8] c"send;%u;%u\00"
define i64 @sendPrepareToSendMsg(i32 %0, i32 %1, i32 %2) {
%4 = alloca [200 x i8]
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%7 = call i64 @sendMessage(i32 %0, i8* %5)
ret i64 %7
}
/* Type definitions */
struct llk_info {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct llk_info *);
void llkfinder_free(struct llk_info *info) { free(info); }


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

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

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

LLVM IR (-O2):
%struct.llk_info = type { i32 }
define void @llkfinder_free(%struct.llk_info* nocapture %0) {
%2 = tail call i32 @free(%struct.llk_info* %0)
ret void
}
/* Variables and functions */
scalar_t__ is_bigendian();
int intVal(int i) {
  unsigned char c1, c2, c3, c4;
  if (is_bigendian()) {
    c1 = i & 255;
    c2 = (i >> 8) & 255;
    c3 = (i >> 16) & 255;
    c4 = (i >> 24) & 255;
    return ((int)c1 << 24) + ((int)c2 << 16) + ((int)c3 << 8) + c4;
  } else {
    return i;
  }
}


x86 assembly (clang, -O0):
<intVal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <is_bigendian@plt>
cmp    $0x0,%rax
je     1188 <intVal+0x78>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
shl    $0x18,%eax
movzbl -0xa(%rbp),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
movzbl -0xb(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
movzbl -0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    118e <intVal+0x7e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intVal>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <is_bigendian@plt>
test   %rax,%rax
mov    %ebx,%eax
bswap  %eax
cmove  %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @intVal(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i32 %0, i32* %3
%8 = call i64 (...) @is_bigendian()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %40
10: ; preds = %1
%11 = load i32, i32* %3
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
store i8 %13, i8* %4
%14 = load i32, i32* %3
%15 = ashr i32 %14, 8
%16 = and i32 %15, 255
%17 = trunc i32 %16 to i8
store i8 %17, i8* %5
%18 = load i32, i32* %3
%19 = ashr i32 %18, 16
%20 = and i32 %19, 255
%21 = trunc i32 %20 to i8
store i8 %21, i8* %6
%22 = load i32, i32* %3
%23 = ashr i32 %22, 24
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
store i8 %25, i8* %7
%26 = load i8, i8* %4
%27 = zext i8 %26 to i32
%28 = shl i32 %27, 24
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = shl i32 %30, 16
%32 = add nsw i32 %28, %31
%33 = load i8, i8* %6
%34 = zext i8 %33 to i32
%35 = shl i32 %34, 8
%36 = add nsw i32 %32, %35
%37 = load i8, i8* %7
%38 = zext i8 %37 to i32
%39 = add nsw i32 %36, %38
store i32 %39, i32* %2
br label %42
40: ; preds = %1
%41 = load i32, i32* %3
store i32 %41, i32* %2
br label %42
42: ; preds = %40, %10
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
define i32 @intVal(i32 %0) {
%2 = tail call i64 (...) @is_bigendian()
%3 = icmp eq i64 %2, 0
%4 = tail call i32 @llvm.bswap.i32(i32 %0)
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int DESBruteForceEncryptCL(uint64_t *output, uint32_t size, uint64_t key_start,
                           uint64_t data) {
  fprintf(stderr, "Unabled to open OpenCL Context.\n OpenCL Support was not "
                  "enabled at compile time\n");
  return 0;
}


x86 assembly (clang, -O0):
<DESBruteForceEncryptCL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
lea    0xecb(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DESBruteForceEncryptCL>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [81 x i8] c"Unabled to open OpenCL Context.\0A OpenCL Support was not enabled at compile time\0A\00"
define i32 @DESBruteForceEncryptCL(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [81 x i8] c"Unabled to open OpenCL Context.\0A OpenCL Support was not enabled at compile time\0A\00"
define i32 @DESBruteForceEncryptCL(i32* nocapture readnone %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void func0(void) {}


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

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

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

LLVM IR (-O2):
define void @func0() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init_board();
int /*<<< orphan*/ test_search();
int main() {
  init_board();
  test_search();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @init_board()
%2 = tail call i32 (...) @test_search()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void dump_filter_any(void *data) { printf("*"); }


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

x86 assembly (clang, -O2):
<dump_filter_any>:
mov    $0x2a,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @dump_filter_any(i8* nocapture readnone %0) {
%2 = tail call i32 @putchar(i32 42)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_)) uint32_t detexPack32RGBA8(int r, int g, int b, int a) {
  return (uint32_t)r | ((uint32_t)g << 8) | ((uint32_t)b << 16) |
         ((uint32_t)a << 24);
}


x86 assembly (clang, -O0):
<detexPack32RGBA8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @detexPack32RGBA8(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = shl i32 %10, 8
%12 = or i32 %9, %11
%13 = load i32, i32* %7
%14 = shl i32 %13, 16
%15 = or i32 %12, %14
%16 = load i32, i32* %8
%17 = shl i32 %16, 24
%18 = or i32 %15, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @detexPack32RGBA8(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %1, 8
%6 = or i32 %5, %0
%7 = shl i32 %2, 16
%8 = or i32 %6, %7
%9 = shl i32 %3, 24
%10 = or i32 %8, %9
ret i32 %10
}
/* Variables and functions */
scalar_t__ malloc(int);
int *get_int_vec(int x) {
  int i;
  int *vec;
  vec = (int *)malloc(x * sizeof(int));
  for (i = 0; i < x; i++) {
    vec[i] = 0;
  }
  return vec;
}


x86 assembly (clang, -O0):
<get_int_vec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115e <get_int_vec+0x4e>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <get_int_vec+0x25>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int_vec>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x0(,%rbx,4),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %ebx,%ebx
jle    1149 <get_int_vec+0x29>
mov    %ebx,%edx
shl    $0x2,%rdx
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32* @get_int_vec(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = mul i64 %6, 4
%8 = trunc i64 %7 to i32
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i32*
store i32* %10, i32** %4
store i32 0, i32* %3
br label %11
11: ; preds = %20, %1
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i32*, i32** %4
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
store i32 0, i32* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %11
23: ; preds = %11
%24 = load i32*, i32** %4
ret i32* %24
}

LLVM IR (-O2):
define i32* @get_int_vec(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i64 @malloc(i32 %2)
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = inttoptr i64 %3 to i8*
%7 = zext i32 %0 to i64
%8 = shl nuw nsw i64 %7, 2
br label %9
9: ; preds = %5, %1
%10 = inttoptr i64 %3 to i32*
ret i32* %10
}