xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ dread(char *, int, int);
unsigned int getUnsignedInt(char *);
unsigned int getInterval() {
  char buffer[2];
  dread(buffer, (0x010), 2);
  return getUnsignedInt(buffer);
}


x86 assembly (clang, -O0):
<getInterval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x2(%rbp),%rdi
mov    $0x10,%esi
mov    $0x2,%edx
call   1040 <dread@plt>
lea    -0x2(%rbp),%rdi
call   1030 <getUnsignedInt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInterval>:
push   %rbx
sub    $0x10,%rsp
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
mov    $0x2,%edx
call   1040 <dread@plt>
mov    %rbx,%rdi
call   1030 <getUnsignedInt@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getInterval() {
%1 = alloca [2 x i8]
%2 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%3 = call i32 @dread(i8* %2, i32 16, i32 2)
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%5 = call i32 @getUnsignedInt(i8* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @getInterval() {
%1 = alloca [2 x i8]
%2 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%3 = call i32 @dread(i8* %2, i32 16, i32 2)
%4 = call i32 @getUnsignedInt(i8* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void keyboardFunc(unsigned char key, int x, int y) {
  if (key == 27)
    exit(-1);
}


x86 assembly (clang, -O0):
<keyboardFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x1b,%eax
jne    113b <keyboardFunc+0x2b>
mov    $0xffffffff,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyboardFunc>:
cmp    $0x1b,%dil
je     1117 <keyboardFunc+0x7>
ret
push   %rax
mov    $0xffffffff,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @keyboardFunc(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 27
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @keyboardFunc(i8 zeroext %0, i32 %1, i32 %2) {
%4 = icmp eq i8 %0, 27
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ReverseGPIOP__1__Out__clr();
void LedsP__Led2__clr(void) { ReverseGPIOP__1__Out__clr(); }


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

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

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

LLVM IR (-O2):
define void @LedsP__Led2__clr() {
%1 = tail call i32 (...) @ReverseGPIOP__1__Out__clr()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void clean() {
  system("/bin/kill -9 tsh tshref mytstpp mytstps mycat myenv myintp myints "
         "myspin1 myspin2 mysplit > /dev/null 2>&1");
}


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

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

LLVM IR (-O0):
@.str = [107 x i8] c"/bin/kill -9 tsh tshref mytstpp mytstps mycat myenv myintp myints myspin1 myspin2 mysplit > /dev/null 2>&1\00"
define void @clean() {
%1 = call i32 @system(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [107 x i8] c"/bin/kill -9 tsh tshref mytstpp mytstps mycat myenv myintp myints myspin1 myspin2 mysplit > /dev/null 2>&1\00"
define void @clean() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *allocator(size_t size, void *context) {
  (void)context;
  return malloc(size);
}


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

x86 assembly (clang, -O2):
<allocator>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @allocator(i64 %0, i8* nocapture readnone %1) {
%3 = tail call i8* @malloc(i64 %0)
ret i8* %3
}
int round_to(int n, int l) { return ((n + l - 1) / l) * l; }


x86 assembly (clang, -O0):
<round_to>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x8(%rbp)
imul   -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_to>:
lea    (%rdi,%rsi,1),%ecx
add    $0xffffffff,%ecx
mov    %ecx,%eax
cltd
idiv   %esi
sub    %edx,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @round_to(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
%8 = sub nsw i32 %7, 1
%9 = load i32, i32* %4
%10 = sdiv i32 %8, %9
%11 = load i32, i32* %4
%12 = mul nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @round_to(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = srem i32 %4, %1
%6 = sub i32 %4, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  int valor1, valor2, suma;
  valor1 = 50;
  valor2 = 25;
  suma = valor1 + valor2;
  printf("La suma de %i y %i es %i\n", valor1, valor2, suma);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x32,-0x4(%rbp)
movl   $0x19,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [26 x i8] c"La suma de %i y %i es %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 50, i32* %1
store i32 25, i32* %2
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = add nsw i32 %4, %5
store i32 %6, i32* %3
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"La suma de %i y %i es %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 50, i32 25, i32 75)
ret i32 0
}
void glutInit(int *argc, char **argv) {}


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

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

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

LLVM IR (-O2):
define void @glutInit(i32* nocapture %0, i8** nocapture %1) {
ret void
}
/* Variables and functions */
int setenv(char const *, char const *, int);
int pyi_setenv(const char *variable, const char *value) {
  int rc;
  rc = setenv(variable, value, 1);
  return rc;
}


x86 assembly (clang, -O0):
<pyi_setenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pyi_setenv>:
mov    $0x1,%edx
jmp    1030 <setenv@plt>

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

LLVM IR (-O2):
define i32 @pyi_setenv(i8* %0, i8* %1) {
%3 = tail call i32 @setenv(i8* %0, i8* %1, i32 1)
ret i32 %3
}
/* Variables and functions */
unsigned strlen(char *str) {
  unsigned size = 0;
  while (str[size])
    size++;
  return size;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
cmpb   $0x0,(%rax,%rcx,1)
je     112e <strlen+0x2e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi,%rax,1)
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %8, %2 ]
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add i32 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void sighandler(int signo) { exit(EXIT_SUCCESS); }


x86 assembly (clang, -O0):
<sighandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<sighandler>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define void @sighandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @EXIT_SUCCESS
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define void @sighandler(i32 %0) {
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
int Hex2Int(const char *p) {
  if (*p <= '9') {
    return *p - '0';
  } else if (*p <= 'F') {
    return *p - 'A' + 10;
  } else {
    return *p - 'a' + 10;
  }
}


x86 assembly (clang, -O0):
<Hex2Int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     112a <Hex2Int+0x2a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <Hex2Int+0x5f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x46,%eax
jg     114f <Hex2Int+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <Hex2Int+0x5f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hex2Int>:
movsbl (%rdi),%ecx
xor    %edx,%edx
cmp    $0x47,%ecx
setb   %dl
shl    $0x5,%edx
add    $0xffffffa9,%edx
cmp    $0x3a,%ecx
mov    $0xffffffd0,%eax
cmovge %edx,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Hex2Int(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = icmp slt i8 %2, 58
%5 = icmp ult i8 %2, 71
%6 = select i1 %5, i32 -55, i32 -87
%7 = select i1 %4, i32 -48, i32 %6
%8 = add nsw i32 %7, %3
ret i32 %8
}
int KMAPI_GetXVersion_MAJOR() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @KMAPI_GetXVersion_MAJOR() {
ret i32 0
}
int syscall_monitor_write_hex(const char *p1) {
  int a;
  asm volatile("int $0x80" : "=a"(a) : "0"(1), "b"((int)p1));
  return a;
}


x86 assembly (clang, -O0):
<syscall_monitor_write_hex>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%ebx
mov    $0x1,%eax
int    $0x80
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall_monitor_write_hex>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%eax
int    $0x80
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @syscall_monitor_write_hex(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 asm sideeffect "int $$0x80", "={ax},0,{bx},~{dirflag},~{fpsr},~{flags}"(i32 1, i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned long);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *Realloc(void *p, size_t len) {
  void *new;
  if (!(new = realloc(p, len))) {
    fprintf(stderr, "Unable to reallocate %lu bytes\n", (unsigned long)len);
    exit(EXIT_FAILURE);
  }
  return new;
}


x86 assembly (clang, -O0):
<Realloc>:
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 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1182 <Realloc+0x52>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe91(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Realloc>:
push   %rbx
mov    %rsi,%rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     1140 <Realloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Unable to reallocate %lu bytes\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @Realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %16, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i64, i64* %4
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %12)
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Unable to reallocate %lu bytes\0A\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @Realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %1)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
ret i8* %3
}
void AONPMCTLJtagPowerOff(void) {
  (*((volatile unsigned long *)(0x40090000 + 0x00000034))) = 0;
}


x86 assembly (clang, -O0):
<AONPMCTLJtagPowerOff>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40090034,%eax
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<AONPMCTLJtagPowerOff>:
movq   $0x0,0x40090034
ret

LLVM IR (-O0):
define void @AONPMCTLJtagPowerOff() {
store volatile i64 0, i64* inttoptr (i64 1074331700 to i64*)
ret void
}

LLVM IR (-O2):
define void @AONPMCTLJtagPowerOff() {
store volatile i64 0, i64* inttoptr (i64 1074331700 to i64*)
ret void
}
/* Variables and functions */
int max(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int theLarge = max(32, 57);
  printf("相对较大的数是：%d", theLarge);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [27 x i8] c"\E7\9B\B8\E5\AF\B9\E8\BE\83\E5\A4\A7\E7\9A\84\E6\95\B0\E6\98\AF\EF\BC\9A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @max(i32 32, i32 57)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"\E7\9B\B8\E5\AF\B9\E8\BE\83\E5\A4\A7\E7\9A\84\E6\95\B0\E6\98\AF\EF\BC\9A%d\00"
define i32 @main() {
%1 = tail call i32 @max(i32 32, i32 57)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void _Q_mul(void) {
  printf("Unimplemented %s called, exiting\n", "_Q_mul");
  exit(-1);
}


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

x86 assembly (clang, -O2):
<_Q_mul>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xef3(%rip),%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Unimplemented %s called, exiting\0A\00"
@.str.1 = [7 x i8] c"_Q_mul\00"
define void @_Q_mul() {
%1 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [34 x i8] c"Unimplemented %s called, exiting\0A\00"
@.str.1 = [7 x i8] c"_Q_mul\00"
define void @_Q_mul() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
void event_free(struct event *ev) { (void)ev; }


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

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

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

LLVM IR (-O2):
%struct.event = type opaque
define void @event_free(%struct.event* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
void handleUnknown(int client, char *packet) {
  printf("Recieved unknown packet from user %d: %s", client, packet);
}


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

x86 assembly (clang, -O2):
<handleUnknown>:
mov    %rsi,%rdx
mov    %edi,%esi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Recieved unknown packet from user %d: %s\00"
define void @handleUnknown(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"Recieved unknown packet from user %d: %s\00"
define void @handleUnknown(i32 %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1)
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ key_vector;
};
struct TYPE_4__ {
  TYPE_1__ xkeymap;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void *get_XEvent_xkeymap_key_vector(void *_p) {
  return (void *)(((XEvent *)_p)->xkeymap.key_vector);
}


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

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

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i8* @get_XEvent_xkeymap_key_vector(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @get_XEvent_xkeymap_key_vector(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
void avio_skip() {}


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

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

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

LLVM IR (-O2):
define void @avio_skip() {
ret void
}
void pre_order(struct atree_node *node) {}


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

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

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

LLVM IR (-O2):
%struct.atree_node = type opaque
define void @pre_order(%struct.atree_node* nocapture %0) {
ret void
}
void TransposeWx8_C() {}


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

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

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

LLVM IR (-O2):
define void @TransposeWx8_C() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ _swprintf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ *concat(int /*<<< orphan*/ const *, int /*<<< orphan*/ *);
wchar_t *concatUInt32(const wchar_t *s, uint32_t n) {
  wchar_t numbertext[32];
  _swprintf(numbertext, L"%u", n);
  return concat(s, numbertext);
}


x86 assembly (clang, -O0):
<concatUInt32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xebd(%rip),%rsi
call   1030 <_swprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <concat@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concatUInt32>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %esi,%edx
mov    %rdi,%rbx
lea    0xeca(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <_swprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <concat@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i32] [i32 37, i32 117, i32 0]
define i32* @concatUInt32(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [32 x i32]
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
%7 = load i32, i32* %4
%8 = call i32 @_swprintf(i32* %6, i8* bitcast ([3 x i32]* @.str to i8*), i32 %7)
%9 = load i32*, i32** %3
%10 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
%11 = call i32* @concat(i32* %9, i32* %10)
ret i32* %11
}

LLVM IR (-O2):
@.str = [3 x i32] [i32 37, i32 117, i32 0]
define i32* @concatUInt32(i32* %0, i32 %1) {
%3 = alloca [32 x i32]
%4 = bitcast [32 x i32]* %3 to i8*
%5 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
%6 = call i32 @_swprintf(i32* %5, i8* bitcast ([3 x i32]* @.str to i8*), i32 %1)
%7 = call i32* @concat(i32* %0, i32* %5)
ret i32* %7
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ror32(uint32_t word, uint32_t shift) {
  return (word >> shift) | (word << (32 - shift));
}


x86 assembly (clang, -O0):
<ror32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ror32>:
mov    %esi,%ecx
mov    %edi,%eax
sar    %cl,%eax
neg    %cl
shl    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @ror32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = ashr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 32, %9
%11 = shl i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @ror32(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
%4 = sub nsw i32 32, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int errno;
char **malloc(int);
int spt_clearenv(void) {
  extern char **environ;
  static char **tmp;
  if (!(tmp = malloc(sizeof *tmp))) {
    return errno;
  }
  tmp[0] = NULL;
  environ = tmp;
  return 0;
}


x86 assembly (clang, -O0):
<spt_clearenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x2f07(%rip)
cmp    $0x0,%rax
jne    1144 <spt_clearenv+0x34>
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    116a <spt_clearenv+0x5a>
mov    0x2ee5(%rip),%rax
movq   $0x0,(%rax)
mov    0x2ed7(%rip),%rcx
mov    0x2e88(%rip),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spt_clearenv>:
push   %rax
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,0x2f0e(%rip)
test   %rax,%rax
je     113c <spt_clearenv+0x2c>
movq   $0x0,(%rax)
mov    0x2eb3(%rip),%rcx
mov    %rax,(%rcx)
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@spt_clearenv.tmp = internal global i8** null
@errno = global i32 0
@environ = external global i8**
define i32 @spt_clearenv() {
%1 = alloca i32
%2 = call i8** @malloc(i32 8)
store i8** %2, i8*** @spt_clearenv.tmp
%3 = icmp ne i8** %2, null
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = load i32, i32* @errno
store i32 %5, i32* %1
br label %10
6: ; preds = %0
%7 = load i8**, i8*** @spt_clearenv.tmp
%8 = getelementptr inbounds i8*, i8** %7, i64 0
store i8* null, i8** %8
%9 = load i8**, i8*** @spt_clearenv.tmp
store i8** %9, i8*** @environ
store i32 0, i32* %1
br label %10
10: ; preds = %6, %4
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@spt_clearenv.tmp = internal unnamed_addr global i8** null
@errno = global i32 0
@environ = external global i8**
define i32 @spt_clearenv() {
%1 = tail call i8** @malloc(i32 8)
store i8** %1, i8*** @spt_clearenv.tmp
%2 = icmp eq i8** %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = load i32, i32* @errno
br label %6
5: ; preds = %0
store i8* null, i8** %1
store i8** %1, i8*** @environ
br label %6
6: ; preds = %5, %3
%7 = phi i32 [ 0, %5 ], [ %4, %3 ]
ret i32 %7
}
/* Variables and functions */
int MDECODE_decode_quoted_printable(char *, int /*<<< orphan*/, char);
int MDECODE_decode_multipart(char *line) {
  return MDECODE_decode_quoted_printable(line, 0, '%');
}


x86 assembly (clang, -O0):
<MDECODE_decode_multipart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x25,%edx
call   1030 <MDECODE_decode_quoted_printable@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MDECODE_decode_multipart>:
xor    %esi,%esi
mov    $0x25,%edx
jmp    1030 <MDECODE_decode_quoted_printable@plt>

LLVM IR (-O0):
define i32 @MDECODE_decode_multipart(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @MDECODE_decode_quoted_printable(i8* %3, i32 0, i8 signext 37)
ret i32 %4
}

LLVM IR (-O2):
define i32 @MDECODE_decode_multipart(i8* %0) {
%2 = tail call i32 @MDECODE_decode_quoted_printable(i8* %0, i32 0, i8 signext 37)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ pipe_dir;

/* Variables and functions */
char *get_tmp_dir();
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
char *get_pipe_dir(void) {
  static char pipe_dir[2048];
  if (!pipe_dir[0])
    snprintf(pipe_dir, sizeof(pipe_dir), "%s/event_pipe", get_tmp_dir());
  return pipe_dir;
}


x86 assembly (clang, -O0):
<get_pipe_dir>:
push   %rbp
mov    %rsp,%rbp
cmpb   $0x0,0x2f15(%rip)
jne    1153 <get_pipe_dir+0x33>
mov    $0x0,%al
call   1040 <get_tmp_dir@plt>
mov    %rax,%rcx
lea    0x2efe(%rip),%rdi
mov    $0x800,%esi
lea    0xeb2(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2ee6(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pipe_dir>:
push   %rax
cmpb   $0x0,0x2f18(%rip)
jne    114c <get_pipe_dir+0x2c>
xor    %eax,%eax
call   1040 <get_tmp_dir@plt>
lea    0x2f08(%rip),%rdi
lea    0xec1(%rip),%rdx
mov    $0x800,%esi
mov    %rax,%rcx
call   1030 <snprintf@plt>
lea    0x2eed(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@get_pipe_dir.pipe_dir = internal global [2048 x i8] zeroinitializer
@.str = [14 x i8] c"%s/event_pipe\00"
define i8* @get_pipe_dir() {
%1 = load i8, i8* getelementptr inbounds ([2048 x i8], [2048 x i8]* @get_pipe_dir.pipe_dir, i64 0, i64 0)
%2 = icmp ne i8 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = call i8* (...) @get_tmp_dir()
%5 = call i32 @snprintf(i8* getelementptr inbounds ([2048 x i8], [2048 x i8]* @get_pipe_dir.pipe_dir, i64 0, i64 0), i32 2048, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %6
6: ; preds = %3, %0
ret i8* getelementptr inbounds ([2048 x i8], [2048 x i8]* @get_pipe_dir.pipe_dir, i64 0, i64 0)
}

LLVM IR (-O2):
@get_pipe_dir.pipe_dir = internal global [2048 x i8] zeroinitializer
@.str = [14 x i8] c"%s/event_pipe\00"
define i8* @get_pipe_dir() {
%1 = load i8, i8* getelementptr inbounds ([2048 x i8], [2048 x i8]* @get_pipe_dir.pipe_dir, i64 0, i64 0)
%2 = icmp eq i8 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i8* (...) @get_tmp_dir()
%5 = tail call i32 @snprintf(i8* getelementptr inbounds ([2048 x i8], [2048 x i8]* @get_pipe_dir.pipe_dir, i64 0, i64 0), i32 2048, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %6
6: ; preds = %3, %0
ret i8* getelementptr inbounds ([2048 x i8], [2048 x i8]* @get_pipe_dir.pipe_dir, i64 0, i64 0)
}
/* Type definitions */
typedef int time_t;

/* Variables and functions */
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ get_tm_struct(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ time(int *);
void sys_time() {
  time_t sec;
  time(&sec);
  if (sec == -1) {
    fprintf(stderr, "error in time function,errno = %d\n", errno);
    exit(-1);
  }
  get_tm_struct(sec);
  return;
}


x86 assembly (clang, -O0):
<sys_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <time@plt>
cmpl   $0xffffffff,-0x4(%rbp)
jne    1183 <sys_time+0x43>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    0x2e6d(%rip),%rax
mov    (%rax),%edx
lea    0xe8c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x4(%rbp),%edi
call   1030 <get_tm_struct@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_time>:
push   %rax
lea    0x4(%rsp),%rdi
call   1050 <time@plt>
mov    0x4(%rsp),%edi
cmp    $0xffffffff,%edi
je     115b <sys_time+0x1b>
call   1030 <get_tm_struct@plt>
pop    %rax
ret
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    0x2e6d(%rip),%rax
mov    (%rax),%edx
lea    0xe8c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"error in time function,errno = %d\0A\00"
@errno = global i32 0
define void @sys_time() {
%1 = alloca i32
%2 = call i32 @time(i32* %1)
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = load i32, i32* @errno
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @exit(i32 -1)
unreachable
10: ; preds = %0
%11 = load i32, i32* %1
%12 = call i32 @get_tm_struct(i32 %11)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"error in time function,errno = %d\0A\00"
@errno = global i32 0
define void @sys_time() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = load i32, i32* @errno
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %0
%12 = call i32 @get_tm_struct(i32 %4)
ret void
}
void freeTab(int **tab) {
  free(*tab);
  free(tab);
}


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

x86 assembly (clang, -O2):
<freeTab>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @freeTab(i32** %0) {
%2 = alloca i32**
store i32** %0, i32*** %2
%3 = load i32**, i32*** %2
%4 = load i32*, i32** %3
%5 = bitcast i32* %4 to i8*
%6 = load i32**, i32*** %2
%7 = bitcast i32** %6 to i8*
ret void
}

LLVM IR (-O2):
define void @freeTab(i32** nocapture %0) {
%2 = bitcast i32** %0 to i8**
%3 = load i8*, i8** %2
tail call void @free(i8* %3)
%4 = bitcast i32** %0 to i8*
tail call void @free(i8* %4)
ret void
}
int fn5(int a, int b) {
  int tem1 = a ^ b;
  int tem2 = a & b;
  return tem1 | tem2;
}


x86 assembly (clang, -O0):
<fn5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fn5(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = xor i32 %7, %8
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = and i32 %10, %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = or i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @fn5(i32 %0, i32 %1) {
%3 = or i32 %1, %0
ret i32 %3
}
void local_after_return(void) {
  return;
  int localvar __attribute__((annotate("localvar_after_return"))) = 3;
}


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

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

LLVM IR (-O0):
define void @local_after_return() {
%1 = alloca i32
ret void
}

LLVM IR (-O2):
define void @local_after_return() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ e_abs();
int /*<<< orphan*/ e_ror();
int /*<<< orphan*/ e_writeback();
void e_ror_abs() {
  e_abs();
  e_ror();
  e_writeback();
}


x86 assembly (clang, -O0):
<e_ror_abs>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <e_abs@plt>
mov    $0x0,%al
call   1030 <e_ror@plt>
mov    $0x0,%al
call   1040 <e_writeback@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<e_ror_abs>:
push   %rax
xor    %eax,%eax
call   1050 <e_abs@plt>
xor    %eax,%eax
call   1030 <e_ror@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <e_writeback@plt>

LLVM IR (-O0):
define void @e_ror_abs() {
%1 = call i32 (...) @e_abs()
%2 = call i32 (...) @e_ror()
%3 = call i32 (...) @e_writeback()
ret void
}

LLVM IR (-O2):
define void @e_ror_abs() {
%1 = tail call i32 (...) @e_abs()
%2 = tail call i32 (...) @e_ror()
%3 = tail call i32 (...) @e_writeback()
ret void
}
/* Variables and functions */
int bin(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", bin(10));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
call   1030 <bin@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @bin(i32 10)
%2 = 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*/ puts(char *);
int printf(const char *fmt, ...) {
  puts("LD_PRELOAD works!!!");
  puts("using libtest.so rather than libc");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"LD_PRELOAD works!!!\00"
@.str.1 = [34 x i8] c"using libtest.so rather than libc\00"
define i32 @printf(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"LD_PRELOAD works!!!\00"
@.str.1 = [34 x i8] c"using libtest.so rather than libc\00"
define i32 @printf(i8* nocapture readnone %0, ...) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
void usage(void) {
  printf("usage: setup%s [ -h ] [ -v ]\n", "");
  puts("  -h	display this help message");
  puts("  -v	display the version");
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
lea    0xedb(%rip),%rsi
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xede(%rip),%rsi
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"usage: setup%s [ -h ] [ -v ]\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [31 x i8] c" -h\09display this help message\00"
@.str.3 = [25 x i8] c" -v\09display the version\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [30 x i8] c"usage: setup%s [ -h ] [ -v ]\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [31 x i8] c" -h\09display this help message\00"
@.str.3 = [25 x i8] c" -v\09display the version\00"
define void @usage() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
int test_imm_7Euint16_reg(unsigned short val) {
  return ((val) & (-0x7E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_7Euint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff82,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_7Euint16_reg>:
test   $0xff82,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_7Euint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -126
%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_7Euint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -126
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int int_shifts_are_arithmetic() {
  int x = ~0;
  return (x >> 1) == x;
}


x86 assembly (clang, -O0):
<int_shifts_are_arithmetic>:
push   %rbp
mov    %rsp,%rbp
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @int_shifts_are_arithmetic() {
%1 = alloca i32
store i32 -1, i32* %1
%2 = load i32, i32* %1
%3 = ashr i32 %2, 1
%4 = load i32, i32* %1
%5 = icmp eq i32 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @int_shifts_are_arithmetic() {
ret i32 1
}
int test_imm_71uint32_mem(unsigned int *val) {
  return ((*val) & (0x71 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_71uint32_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, 113
%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_71uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 113
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fasync_handler(int num) { printf("fasync_handler entering\n"); }


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

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

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

LLVM IR (-O2):
@str = [24 x i8] c"fasync_handler entering\00"
define void @fasync_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}
unsigned int test_11(unsigned int a, int b) { return (a << 2) | (b & 1); }


x86 assembly (clang, -O0):
<test_11>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
mov    -0x8(%rbp),%ecx
and    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_11>:
and    $0x1,%esi
lea    (%rsi,%rdi,4),%eax
ret

LLVM IR (-O0):
define i32 @test_11(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = shl i32 %5, 2
%7 = load i32, i32* %4
%8 = and i32 %7, 1
%9 = or i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_11(i32 %0, i32 %1) {
%3 = shl i32 %0, 2
%4 = and i32 %1, 1
%5 = or i32 %4, %3
ret i32 %5
}
void ami_context_menu_show(struct gui_window_2 *gwin, int x, int y) {}


x86 assembly (clang, -O0):
<ami_context_menu_show>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.gui_window_2 = type opaque
define void @ami_context_menu_show(%struct.gui_window_2* nocapture %0, i32 %1, i32 %2) {
ret void
}