xunge/DecIR huggingface dataset:
/* Variables and functions */
int greatest_common_divisor(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int a = 30, b = 10;
  for (b = 10; b < a; b++)
    printf("a=%d, b=%d, gcf=%d\n", a, b, greatest_common_divisor(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1e,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1189 <main+0x69>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <greatest_common_divisor@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xa,%ebx
lea    0xed0(%rip),%r14
mov    $0x1e,%edi
mov    %ebx,%esi
call   1040 <greatest_common_divisor@plt>
mov    %r14,%rdi
mov    $0x1e,%esi
mov    %ebx,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    1130 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"a=%d, b=%d, gcf=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 30, i32* %2
store i32 10, i32* %3
store i32 10, i32* %3
br label %4
4: ; preds = %15, %0
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 @greatest_common_divisor(i32 %11, i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 %13)
br label %15
15: ; preds = %8
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %4
18: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"a=%d, b=%d, gcf=%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 10, %0 ], [ %5, %1 ]
%3 = tail call i32 @greatest_common_divisor(i32 30, i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 30, i32 %2, i32 %3)
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 30
br i1 %6, label %7, label %1
7: ; preds = %1
ret i32 0
}
char *strrchr(const char *s, int c) {
  const char *t = s + strlen(s);
  for (; t >= s; t--) {
    if (*t == c) {
      return (char *)t;
    }
  }
  return 0UL;
}


x86 assembly (clang, -O0):
<strrchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jb     117f <strrchr+0x6f>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1169 <strrchr+0x59>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1187 <strrchr+0x77>
jmp    116e <strrchr+0x5e>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    113e <strrchr+0x2e>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrchr>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
js     1140 <strrchr+0x30>
add    %rbx,%rax
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%rax),%ecx
cmp    %ebp,%ecx
je     1142 <strrchr+0x32>
add    $0xffffffffffffffff,%rax
cmp    %rbx,%rax
jae    1130 <strrchr+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @strrchr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = getelementptr inbounds i8, i8* %7, i64 %9
store i8* %10, i8** %6
br label %11
11: ; preds = %24, %2
%12 = load i8*, i8** %6
%13 = load i8*, i8** %4
%14 = icmp uge i8* %12, %13
br i1 %14, label %15, label %27
15: ; preds = %11
%16 = load i8*, i8** %6
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = load i32, i32* %5
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = load i8*, i8** %6
store i8* %22, i8** %3
br label %28
23: ; preds = %15
br label %24
24: ; preds = %23
%25 = load i8*, i8** %6
%26 = getelementptr inbounds i8, i8* %25, i32 -1
store i8* %26, i8** %6
br label %11
27: ; preds = %11
store i8* null, i8** %3
br label %28
28: ; preds = %27, %21
%29 = load i8*, i8** %3
ret i8* %29
}

LLVM IR (-O2):
define i8* @strrchr(i8* %0, i32 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = icmp slt i64 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 %3
br label %7
7: ; preds = %5, %12
%8 = phi i8* [ %13, %12 ], [ %6, %5 ]
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, %1
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = getelementptr inbounds i8, i8* %8, i64 -1
%14 = icmp ult i8* %13, %0
br i1 %14, label %15, label %7
15: ; preds = %7, %12, %2
%16 = phi i8* [ null, %2 ], [ null, %12 ], [ %8, %7 ]
ret i8* %16
}
/* Type definitions */
struct irc {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sendStr(struct irc *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
void enterChan(struct irc *bot, char *chan) {
  char msg[1024];
  snprintf(msg, 1024 - 1, "JOIN %s\r\n", chan);
  sendStr(bot, msg);
}


x86 assembly (clang, -O0):
<enterChan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x3ff,%esi
lea    0xeb6(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <sendStr@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enterChan>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rcx
mov    %rdi,%rbx
lea    0xec9(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x3ff,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sendStr@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.irc = type { i32 }
@.str = [10 x i8] c"JOIN %s\0D\0A\00"
define void @enterChan(%struct.irc* %0, i8* %1) {
%3 = alloca %struct.irc*
%4 = alloca i8*
%5 = alloca [1024 x i8]
store %struct.irc* %0, %struct.irc** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %4
%8 = call i32 @snprintf(i8* %6, i32 1023, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load %struct.irc*, %struct.irc** %3
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = call i32 @sendStr(%struct.irc* %9, i8* %10)
ret void
}

LLVM IR (-O2):
%struct.irc = type { i32 }
@.str = [10 x i8] c"JOIN %s\0D\0A\00"
define void @enterChan(%struct.irc* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 1023, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = call i32 @sendStr(%struct.irc* %0, i8* %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void save_file(char *chiper, char *name) {
  FILE *fp;
  fp = NULL;
  fp = fopen(name, "w+");
  fprintf(fp, "%s\n", chiper);
  fclose(fp);
}


x86 assembly (clang, -O0):
<save_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_file>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rax
mov    %rdi,%r14
lea    0xebf(%rip),%rsi
mov    %rax,%rdi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xeb0(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"w+\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @save_file(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32* null, i32** %5
%6 = load i8*, i8** %4
%7 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i8*, i8** %3
%10 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i32*, i32** %5
%12 = call i32 @fclose(i32* %11)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"w+\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @save_file(i8* %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%5 = tail call i32 @fclose(i32* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __inc_remove_counter();
int __unlinkat(int, char const *, int);
int unlinkat(int fd, const char *path, int flag) {
  int res = __unlinkat(fd, path, flag);
  if (res == 0)
    __inc_remove_counter();
  return res;
}


x86 assembly (clang, -O0):
<unlinkat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <__unlinkat@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1155 <unlinkat+0x35>
mov    $0x0,%al
call   1040 <__inc_remove_counter@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unlinkat>:
push   %rbx
call   1030 <__unlinkat@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1133 <unlinkat+0x13>
xor    %eax,%eax
call   1040 <__inc_remove_counter@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @unlinkat(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @__unlinkat(i32 %8, i8* %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 (...) @__inc_remove_counter()
br label %16
16: ; preds = %14, %3
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @unlinkat(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @__unlinkat(i32 %0, i8* %1, i32 %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @__inc_remove_counter()
br label %8
8: ; preds = %6, %3
ret i32 %4
}
void XkbSetIndicatorMap() {}


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

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

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

LLVM IR (-O2):
define void @XkbSetIndicatorMap() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hang();
int kmain() {
  hang();
  return 1;
}


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

x86 assembly (clang, -O2):
<kmain>:
push   %rax
xor    %eax,%eax
call   1030 <hang@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @kmain() {
%1 = call i32 (...) @hang()
ret i32 1
}

LLVM IR (-O2):
define i32 @kmain() {
%1 = tail call i32 (...) @hang()
ret i32 1
}
void writew(unsigned short value, unsigned int address) {
  *((volatile unsigned short *)address) = value;
}


x86 assembly (clang, -O0):
<writew>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x2(%rbp),%cx
mov    -0x8(%rbp),%eax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<writew>:
mov    %esi,%eax
mov    %di,(%rax)
ret

LLVM IR (-O0):
define void @writew(i16 zeroext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
store i16 %0, i16* %3
store i32 %1, i32* %4
%5 = load i16, i16* %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i16*
store volatile i16 %5, i16* %8
ret void
}

LLVM IR (-O2):
define void @writew(i16 zeroext %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = inttoptr i64 %3 to i16*
store volatile i16 %0, i16* %4
ret void
}
__attribute__((always_)) int cpuid(int info[4], int level, int sublevel) {
  __asm__ volatile("cpuid"
                   : "=a"(info[(0)]), "=b"(info[(1)]), "=c"(info[(2)]),
                     "=d"(info[(3)])
                   : "a"(level), "c"(sublevel));
  return 1;
}


x86 assembly (clang, -O0):
<cpuid>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%r8
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
cpuid
mov    %eax,%r9d
mov    -0x28(%rbp),%rax
mov    %ecx,%esi
mov    -0x20(%rbp),%rcx
mov    %r9d,(%r8)
mov    %ebx,0x4(%rdi)
mov    %esi,0x8(%rcx)
mov    %edx,0xc(%rax)
mov    $0x1,%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid>:
push   %rbx
mov    %edx,%ecx
mov    %esi,%eax
cpuid
mov    %eax,(%rdi)
mov    %ebx,0x4(%rdi)
mov    %ecx,0x8(%rdi)
mov    %edx,0xc(%rdi)
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cpuid(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 2
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 3
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},{ax},{cx},~{dirflag},~{fpsr},~{flags}"(i32 %15, i32 %16)
%18 = extractvalue { i32, i32, i32, i32 } %17, 0
%19 = extractvalue { i32, i32, i32, i32 } %17, 1
%20 = extractvalue { i32, i32, i32, i32 } %17, 2
%21 = extractvalue { i32, i32, i32, i32 } %17, 3
store i32 %18, i32* %8
store i32 %19, i32* %10
store i32 %20, i32* %12
store i32 %21, i32* %14
ret i32 1
}

LLVM IR (-O2):
define i32 @cpuid(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = getelementptr inbounds i32, i32* %0, i64 2
%6 = getelementptr inbounds i32, i32* %0, i64 3
%7 = tail call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},{ax},{cx},~{dirflag},~{fpsr},~{flags}"(i32 %1, i32 %2)
%8 = extractvalue { i32, i32, i32, i32 } %7, 0
%9 = extractvalue { i32, i32, i32, i32 } %7, 1
%10 = extractvalue { i32, i32, i32, i32 } %7, 2
%11 = extractvalue { i32, i32, i32, i32 } %7, 3
store i32 %8, i32* %0
store i32 %9, i32* %4
store i32 %10, i32* %5
store i32 %11, i32* %6
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ print_nibble(unsigned char);
void print_hex(unsigned char c) {
  print_nibble(c >> 4);
  print_nibble(c & 0xF);
}


x86 assembly (clang, -O0):
<print_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
movzbl %al,%edi
call   1030 <print_nibble@plt>
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
movzbl %al,%edi
call   1030 <print_nibble@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_hex>:
push   %rbx
mov    %edi,%ebx
mov    %ebx,%eax
shr    $0x4,%al
movzbl %al,%edi
call   1030 <print_nibble@plt>
and    $0xf,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <print_nibble@plt>

LLVM IR (-O0):
define void @print_hex(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = ashr i32 %4, 4
%6 = trunc i32 %5 to i8
%7 = call i32 @print_nibble(i8 zeroext %6)
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = and i32 %9, 15
%11 = trunc i32 %10 to i8
%12 = call i32 @print_nibble(i8 zeroext %11)
ret void
}

LLVM IR (-O2):
define void @print_hex(i8 zeroext %0) {
%2 = lshr i8 %0, 4
%3 = tail call i32 @print_nibble(i8 zeroext %2)
%4 = and i8 %0, 15
%5 = tail call i32 @print_nibble(i8 zeroext %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init(char *);
int ok();
int main() {
  init("external storage");
  return ok();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <init@plt>
mov    $0x0,%al
call   1030 <ok@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ok@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"external storage\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @init(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @ok()
ret i32 %3
}

LLVM IR (-O2):
@.str = [17 x i8] c"external storage\00"
define i32 @main() {
%1 = tail call i32 @init(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @ok()
ret i32 %2
}
int calculate_sum(int n) {
  int sum = 0;
  while (n) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}


x86 assembly (clang, -O0):
<calculate_sum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113c <calculate_sum+0x3c>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <calculate_sum+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_sum>:
xor    %eax,%eax
test   %edi,%edi
je     113b <calculate_sum+0x3b>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %esi,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <calculate_sum+0x10>
ret

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

LLVM IR (-O2):
define i32 @calculate_sum(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = srem i32 %5, 10
%7 = add nsw i32 %4, %6
%8 = sdiv i32 %5, 10
%9 = add i32 %5, 9
%10 = icmp ult i32 %9, 19
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %12
}
void ff_hevc_put_hevc_qpel_v32_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_qpel_v32_10_sse4() {
ret void
}
/* Variables and functions */
int nresources_(double *, double *, long *, long *, long *, long *, long *,
                long *);
int nresources(double *ut, double *st, long *mem, long *par, long *paf,
               long *swa, long *dr, long *dw) {
  return nresources_(ut, st, mem, par, paf, swa, dr, dw);
}


x86 assembly (clang, -O0):
<nresources>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <nresources_@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nresources>:
jmp    1030 <nresources_@plt>

LLVM IR (-O0):
define i32 @nresources(double* %0, double* %1, i64* %2, i64* %3, i64* %4, i64* %5, i64* %6, i64* %7) {
%9 = alloca double*
%10 = alloca double*
%11 = alloca i64*
%12 = alloca i64*
%13 = alloca i64*
%14 = alloca i64*
%15 = alloca i64*
%16 = alloca i64*
store double* %0, double** %9
store double* %1, double** %10
store i64* %2, i64** %11
store i64* %3, i64** %12
store i64* %4, i64** %13
store i64* %5, i64** %14
store i64* %6, i64** %15
store i64* %7, i64** %16
%17 = load double*, double** %9
%18 = load double*, double** %10
%19 = load i64*, i64** %11
%20 = load i64*, i64** %12
%21 = load i64*, i64** %13
%22 = load i64*, i64** %14
%23 = load i64*, i64** %15
%24 = load i64*, i64** %16
%25 = call i32 @nresources_(double* %17, double* %18, i64* %19, i64* %20, i64* %21, i64* %22, i64* %23, i64* %24)
ret i32 %25
}

LLVM IR (-O2):
define i32 @nresources(double* %0, double* %1, i64* %2, i64* %3, i64* %4, i64* %5, i64* %6, i64* %7) {
%9 = tail call i32 @nresources_(double* %0, double* %1, i64* %2, i64* %3, i64* %4, i64* %5, i64* %6, i64* %7)
ret i32 %9
}
/* Variables and functions */
int yas_mma8453q_read_reg_byte(int);
int /*<<< orphan*/ yas_mma8453q_write_reg_byte(int, int);
int yas_mma8453q_power_up(void) {
  yas_mma8453q_write_reg_byte(
      0x0f, ((yas_mma8453q_read_reg_byte(0x0f) & ~0x10) | ((1) << 4)));
  yas_mma8453q_write_reg_byte(
      0x2a, ((yas_mma8453q_read_reg_byte(0x2a) & ~0x01) | ((1) << 0)));
  return (0);
}


x86 assembly (clang, -O0):
<yas_mma8453q_power_up>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%edi
call   1030 <yas_mma8453q_read_reg_byte@plt>
mov    %eax,%esi
and    $0xffffffef,%esi
or     $0x10,%esi
mov    $0xf,%edi
call   1040 <yas_mma8453q_write_reg_byte@plt>
mov    $0x2a,%edi
call   1030 <yas_mma8453q_read_reg_byte@plt>
mov    %eax,%esi
and    $0xfffffffe,%esi
or     $0x1,%esi
mov    $0x2a,%edi
call   1040 <yas_mma8453q_write_reg_byte@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<yas_mma8453q_power_up>:
push   %rax
mov    $0xf,%edi
call   1030 <yas_mma8453q_read_reg_byte@plt>
or     $0x10,%eax
mov    $0xf,%edi
mov    %eax,%esi
call   1040 <yas_mma8453q_write_reg_byte@plt>
mov    $0x2a,%edi
call   1030 <yas_mma8453q_read_reg_byte@plt>
or     $0x1,%eax
mov    $0x2a,%edi
mov    %eax,%esi
call   1040 <yas_mma8453q_write_reg_byte@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @yas_mma8453q_power_up() {
%1 = call i32 @yas_mma8453q_read_reg_byte(i32 15)
%2 = and i32 %1, -17
%3 = or i32 %2, 16
%4 = call i32 @yas_mma8453q_write_reg_byte(i32 15, i32 %3)
%5 = call i32 @yas_mma8453q_read_reg_byte(i32 42)
%6 = and i32 %5, -2
%7 = or i32 %6, 1
%8 = call i32 @yas_mma8453q_write_reg_byte(i32 42, i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @yas_mma8453q_power_up() {
%1 = tail call i32 @yas_mma8453q_read_reg_byte(i32 15)
%2 = or i32 %1, 16
%3 = tail call i32 @yas_mma8453q_write_reg_byte(i32 15, i32 %2)
%4 = tail call i32 @yas_mma8453q_read_reg_byte(i32 42)
%5 = or i32 %4, 1
%6 = tail call i32 @yas_mma8453q_write_reg_byte(i32 42, i32 %5)
ret i32 0
}
int mod(int x, int y) { return (0 != y ? x % y : 0xffffffff); }


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
je     1124 <mod+0x24>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
jmp    1131 <mod+0x31>
mov    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <mod+0x31>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod>:
test   %esi,%esi
je     110c <mod+0xc>
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @mod(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 0, %5
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = srem i32 %8, %9
br label %12
11: ; preds = %2
br label %12
12: ; preds = %11, %7
%13 = phi i32 [ %10, %7 ], [ -1, %11 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @mod(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = srem i32 %0, %1
br label %6
6: ; preds = %2, %4
%7 = phi i32 [ %5, %4 ], [ -1, %2 ]
ret i32 %7
}
/* Variables and functions */
int sqrt(int);
int internal_sqrt_i(int value) { return sqrt(value); }


x86 assembly (clang, -O0):
<internal_sqrt_i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_sqrt_i>:
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define i32 @internal_sqrt_i(i32 %0) {
%2 = tail call i32 @sqrt(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
unsigned int hweight16(uint16_t w) {
  unsigned int res = w - ((w >> 1) & 0x5555);
  res = (res & 0x3333) + ((res >> 2) & 0x3333);
  res = (res + (res >> 4)) & 0x0F0F;
  return (res + (res >> 8)) & 0x00FF;
}


x86 assembly (clang, -O0):
<hweight16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x1,%ecx
and    $0x5555,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3333,%eax
mov    -0x8(%rbp),%ecx
shr    $0x2,%ecx
and    $0x3333,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x8,%ecx
add    %ecx,%eax
and    $0xff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @hweight16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = ashr i32 %5, 1
%7 = and i32 %6, 21845
%8 = sub nsw i32 %4, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = and i32 %9, 13107
%11 = load i32, i32* %3
%12 = lshr i32 %11, 2
%13 = and i32 %12, 13107
%14 = add i32 %10, %13
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = lshr i32 %16, 4
%18 = add i32 %15, %17
%19 = and i32 %18, 3855
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = load i32, i32* %3
%22 = lshr i32 %21, 8
%23 = add i32 %20, %22
%24 = and i32 %23, 255
ret i32 %24
}

LLVM IR (-O2):
define i32 @hweight16(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 21845
%4 = sub nsw i32 %0, %3
%5 = and i32 %4, 13107
%6 = lshr i32 %4, 2
%7 = and i32 %6, 13107
%8 = add nuw nsw i32 %7, %5
%9 = lshr i32 %8, 4
%10 = add nuw nsw i32 %9, %8
%11 = and i32 %10, 3855
%12 = lshr i32 %11, 8
%13 = add nuw nsw i32 %12, %11
%14 = and i32 %13, 31
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ tempString;

/* Variables and functions */
scalar_t__ portWrite(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, int);
int setCommandInt(int data, const char *cmd) {
  char tempString[16];
  snprintf(tempString, sizeof(tempString), "%s%d#", cmd, data);
  if (portWrite(tempString) < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<setCommandInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%r8d
mov    $0x10,%esi
lea    0xeb9(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <portWrite@plt>
cmp    $0x0,%rax
jge    116b <setCommandInt+0x4b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1172 <setCommandInt+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setCommandInt>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rcx
mov    %edi,%r8d
lea    0xece(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <portWrite@plt>
sar    $0x3f,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s%d#\00"
define i32 @setCommandInt(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [16 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%8 = load i8*, i8** %5
%9 = load i32, i32* %4
%10 = call i32 @snprintf(i8* %7, i32 16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9)
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%12 = call i64 @portWrite(i8* %11)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 -1, i32* %3
br label %16
15: ; preds = %2
store i32 0, i32* %3
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s%d#\00"
define i32 @setCommandInt(i32 %0, i8* %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %0)
%6 = call i64 @portWrite(i8* %4)
%7 = ashr i64 %6, 63
%8 = trunc i64 %7 to i32
ret i32 %8
}
int loadPointIntAtfrom(int index, int intArray) {
  return (((int *)intArray))[index];
}


x86 assembly (clang, -O0):
<loadPointIntAtfrom>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadPointIntAtfrom>:
movslq %esi,%rax
movslq %edi,%rcx
mov    (%rax,%rcx,4),%eax
ret

LLVM IR (-O0):
define i32 @loadPointIntAtfrom(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %7, i64 %9
%11 = load i32, i32* %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @loadPointIntAtfrom(i32 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = inttoptr i64 %3 to i32*
%5 = sext i32 %0 to i64
%6 = getelementptr inbounds i32, i32* %4, i64 %5
%7 = load i32, i32* %6
ret i32 %7
}
void GC_add_map_entry(void) {}


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

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

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

LLVM IR (-O2):
define void @GC_add_map_entry() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(long);
void Pa_Sleep(long msec) {
  while (msec > 999) {
    usleep(999000);
    msec -= 999;
  }
  usleep(msec * 1000);
}


x86 assembly (clang, -O0):
<Pa_Sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x3e7,-0x8(%rbp)
jle    1147 <Pa_Sleep+0x37>
mov    $0xf3e58,%edi
call   1030 <usleep@plt>
mov    -0x8(%rbp),%rax
sub    $0x3e7,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <Pa_Sleep+0xc>
imul   $0x3e8,-0x8(%rbp),%rdi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pa_Sleep>:
push   %rbx
mov    %rdi,%rbx
cmp    $0x3e8,%rdi
jl     113f <Pa_Sleep+0x2f>
nopl   (%rax)
mov    $0xf3e58,%edi
call   1030 <usleep@plt>
lea    -0x3e7(%rbx),%rax
cmp    $0x7ce,%rbx
mov    %rax,%rbx
ja     1120 <Pa_Sleep+0x10>
jmp    1142 <Pa_Sleep+0x32>
mov    %rbx,%rax
imul   $0x3e8,%rax,%rdi
pop    %rbx
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @Pa_Sleep(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
br label %3
3: ; preds = %6, %1
%4 = load i64, i64* %2
%5 = icmp sgt i64 %4, 999
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = call i32 @usleep(i64 999000)
%8 = load i64, i64* %2
%9 = sub nsw i64 %8, 999
store i64 %9, i64* %2
br label %3
10: ; preds = %3
%11 = load i64, i64* %2
%12 = mul nsw i64 %11, 1000
%13 = call i32 @usleep(i64 %12)
ret void
}

LLVM IR (-O2):
define void @Pa_Sleep(i64 %0) {
%2 = icmp sgt i64 %0, 999
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i64 [ %6, %3 ], [ %0, %1 ]
%5 = tail call i32 @usleep(i64 999000)
%6 = add nsw i64 %4, -999
%7 = icmp ugt i64 %4, 1998
br i1 %7, label %3, label %8
8: ; preds = %3, %1
%9 = phi i64 [ %0, %1 ], [ %6, %3 ]
%10 = mul nsw i64 %9, 1000
%11 = tail call i32 @usleep(i64 %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CL_Shutdown();
int FNDELAY;
int /*<<< orphan*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ Sys_Exit(int /*<<< orphan*/);
int fcntl(int /*<<< orphan*/, int /*<<< orphan*/, int);
void Sys_Quit(void) {
  CL_Shutdown();
  fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~FNDELAY);
  Sys_Exit(0);
}


x86 assembly (clang, -O0):
<Sys_Quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <CL_Shutdown@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
mov    %edx,%edi
call   1030 <fcntl@plt>
mov    -0x4(%rbp),%esi
mov    %eax,%edx
mov    0x2e67(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    %eax,%edx
xor    %edi,%edi
call   1030 <fcntl@plt>
xor    %edi,%edi
call   1050 <Sys_Exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sys_Quit>:
push   %rbx
xor    %eax,%eax
call   1040 <CL_Shutdown@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%ebx
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    0x2e76(%rip),%rcx
mov    (%rcx),%edx
not    %edx
and    %eax,%edx
xor    %edi,%edi
mov    %ebx,%esi
call   1030 <fcntl@plt>
xor    %edi,%edi
pop    %rbx
jmp    1050 <Sys_Exit@plt>

LLVM IR (-O0):
@F_SETFL = global i32 0
@F_GETFL = global i32 0
@FNDELAY = global i32 0
define void @Sys_Quit() {
%1 = call i32 (...) @CL_Shutdown()
%2 = load i32, i32* @F_SETFL
%3 = load i32, i32* @F_GETFL
%4 = call i32 @fcntl(i32 0, i32 %3, i32 0)
%5 = load i32, i32* @FNDELAY
%6 = xor i32 %5, -1
%7 = and i32 %4, %6
%8 = call i32 @fcntl(i32 0, i32 %2, i32 %7)
%9 = call i32 @Sys_Exit(i32 0)
ret void
}

LLVM IR (-O2):
@F_SETFL = global i32 0
@F_GETFL = global i32 0
@FNDELAY = global i32 0
define void @Sys_Quit() {
%1 = tail call i32 (...) @CL_Shutdown()
%2 = load i32, i32* @F_SETFL
%3 = load i32, i32* @F_GETFL
%4 = tail call i32 @fcntl(i32 0, i32 %3, i32 0)
%5 = load i32, i32* @FNDELAY
%6 = xor i32 %5, -1
%7 = and i32 %4, %6
%8 = tail call i32 @fcntl(i32 0, i32 %2, i32 %7)
%9 = tail call i32 @Sys_Exit(i32 0)
ret void
}
char *meson_print(void) { return "Hello, world!"; }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, world!\00"
define i8* @meson_print() {
ret i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, world!\00"
define i8* @meson_print() {
ret i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0)
}
void heap_prob(int *n, int *A, int *n0, int *A0, double *prob) {
  double heap_recur(int n, int A, int n0, int A0);
  *prob = heap_recur(*n, *A, *n0, *A0);
}


x86 assembly (clang, -O0):
<heap_prob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
call   1030 <heap_recur@plt>
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heap_prob>:
push   %rbx
mov    %r8,%rbx
mov    (%rdi),%edi
mov    (%rsi),%esi
mov    (%rdx),%edx
mov    (%rcx),%ecx
call   1030 <heap_recur@plt>
movsd  %xmm0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @heap_prob(i32* %0, i32* %1, i32* %2, i32* %3, double* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca double*
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store double* %4, double** %10
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = load i32*, i32** %7
%14 = load i32, i32* %13
%15 = load i32*, i32** %8
%16 = load i32, i32* %15
%17 = load i32*, i32** %9
%18 = load i32, i32* %17
%19 = call double @heap_recur(i32 %12, i32 %14, i32 %16, i32 %18)
%20 = load double*, double** %10
store double %19, double* %20
ret void
}

LLVM IR (-O2):
define void @heap_prob(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture %3, double* nocapture writeonly %4) {
%6 = load i32, i32* %0
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = tail call double @heap_recur(i32 %6, i32 %7, i32 %8, i32 %9)
store double %10, double* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void display_help(void) {
  fprintf(stderr,
          "\nOptions:\n"
          "  -h          Display this help and exit.\n"
          "  -e          Erase/delete all pictures.\n"
          "  -d DEVICE   Use DEVICE instead of %s.\n"
          "  -c          Color output (default) (PPM format).\n"
          "  -g          Greyscale output (luminance only) (PGM format).\n"
          "  -r          Raw component output (no quantization) (PGM format).\n"
          "  -n          No JPEG decoding (dump raw picture data).\n\n",
          "/dev/ttyS0");
}


x86 assembly (clang, -O0):
<display_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
lea    0x1048(%rip),%rdx
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_help>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
lea    0x104c(%rip),%rdx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [371 x i8] c"\0AOptions:\0A -h Display this help and exit.\0A -e Erase/delete all pictures.\0A -d DEVICE Use DEVICE instead of %s.\0A -c Color output (default) (PPM format).\0A -g Greyscale output (luminance only) (PGM format).\0A -r Raw component output (no quantization) (PGM format).\0A -n No JPEG decoding (dump raw picture data).\0A\0A\00"
@.str.1 = [11 x i8] c"/dev/ttyS0\00"
define void @display_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([371 x i8], [371 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [371 x i8] c"\0AOptions:\0A -h Display this help and exit.\0A -e Erase/delete all pictures.\0A -d DEVICE Use DEVICE instead of %s.\0A -c Color output (default) (PPM format).\0A -g Greyscale output (luminance only) (PGM format).\0A -r Raw component output (no quantization) (PGM format).\0A -n No JPEG decoding (dump raw picture data).\0A\0A\00"
@.str.1 = [11 x i8] c"/dev/ttyS0\00"
define void @display_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([371 x i8], [371 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int yas_mma8452q_write_reg(unsigned char, unsigned char *, int);
int yas_mma8452q_write_reg_byte(unsigned char adr, unsigned char val) {
  return yas_mma8452q_write_reg(adr, &val, 1);
}


x86 assembly (clang, -O0):
<yas_mma8452q_write_reg_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
lea    -0x2(%rbp),%rsi
mov    $0x1,%edx
movzbl -0x1(%rbp),%edi
call   1030 <yas_mma8452q_write_reg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yas_mma8452q_write_reg_byte>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <yas_mma8452q_write_reg@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @yas_mma8452q_write_reg_byte(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = call i32 @yas_mma8452q_write_reg(i8 zeroext %5, i8* %4, i32 1)
ret i32 %6
}

LLVM IR (-O2):
define i32 @yas_mma8452q_write_reg_byte(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 @yas_mma8452q_write_reg(i8 zeroext %0, i8* %3, i32 1)
ret i32 %4
}
/* Variables and functions */
double pow(float, float);
float MRFP_LP(float MRFP_con) {
  float coeff = (1 / 0.699);
  float y = 100.13 * pow(MRFP_con, coeff);
  return y;
}


x86 assembly (clang, -O0):
<MRFP_LP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xee3(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xebc(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MRFP_LP>:
push   %rax
movss  0xee7(%rip),%xmm1
call   1030 <pow@plt>
mulsd  0xee2(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @MRFP_LP(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
store float 0x3FF6E3CCC0000000, float* %3
%5 = load float, float* %2
%6 = load float, float* %3
%7 = call double @pow(float %5, float %6)
%8 = fmul double 1.001300e+02, %7
%9 = fptrunc double %8 to float
store float %9, float* %4
%10 = load float, float* %4
ret float %10
}

LLVM IR (-O2):
define float @MRFP_LP(float %0) {
%2 = tail call double @pow(float %0, float 0x3FF6E3CCC0000000)
%3 = fmul double %2, 1.001300e+02
%4 = fptrunc double %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ gdt_addentry(int, int /*<<< orphan*/, int, int, int);
int /*<<< orphan*/ gdt_flush();
void gdt_init() {
  gdt_addentry(0, 0, 0, 0, 0);
  gdt_addentry(1, 0, 0xFFFFFFF, 0x9A, 0xCF);
  gdt_addentry(2, 0, 0xFFFFFFF, 0x92, 0xCF);
  gdt_flush();
}


x86 assembly (clang, -O0):
<gdt_init>:
push   %rbp
mov    %rsp,%rbp
xor    %r8d,%r8d
mov    %r8d,%edi
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <gdt_addentry@plt>
mov    $0x1,%edi
xor    %esi,%esi
mov    $0xfffffff,%edx
mov    $0x9a,%ecx
mov    $0xcf,%r8d
call   1030 <gdt_addentry@plt>
mov    $0x2,%edi
xor    %esi,%esi
mov    $0xfffffff,%edx
mov    $0x92,%ecx
mov    $0xcf,%r8d
call   1030 <gdt_addentry@plt>
mov    $0x0,%al
call   1040 <gdt_flush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdt_init>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <gdt_addentry@plt>
mov    $0x1,%edi
xor    %esi,%esi
mov    $0xfffffff,%edx
mov    $0x9a,%ecx
mov    $0xcf,%r8d
call   1030 <gdt_addentry@plt>
mov    $0x2,%edi
xor    %esi,%esi
mov    $0xfffffff,%edx
mov    $0x92,%ecx
mov    $0xcf,%r8d
call   1030 <gdt_addentry@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <gdt_flush@plt>

LLVM IR (-O0):
define void @gdt_init() {
%1 = call i32 @gdt_addentry(i32 0, i32 0, i32 0, i32 0, i32 0)
%2 = call i32 @gdt_addentry(i32 1, i32 0, i32 268435455, i32 154, i32 207)
%3 = call i32 @gdt_addentry(i32 2, i32 0, i32 268435455, i32 146, i32 207)
%4 = call i32 (...) @gdt_flush()
ret void
}

LLVM IR (-O2):
define void @gdt_init() {
%1 = tail call i32 @gdt_addentry(i32 0, i32 0, i32 0, i32 0, i32 0)
%2 = tail call i32 @gdt_addentry(i32 1, i32 0, i32 268435455, i32 154, i32 207)
%3 = tail call i32 @gdt_addentry(i32 2, i32 0, i32 268435455, i32 146, i32 207)
%4 = tail call i32 (...) @gdt_flush()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printk(char *);
int /*<<< orphan*/ vfree(void *);
void vfree_helper(void *ptr) {
  printk("Delayed deallocation\n");
  vfree(ptr);
}


x86 assembly (clang, -O0):
<vfree_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printk@plt>
mov    -0x8(%rbp),%rdi
call   1040 <vfree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vfree_helper>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printk@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <vfree@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Delayed deallocation\0A\00"
define void @vfree_helper(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printk(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @vfree(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Delayed deallocation\0A\00"
define void @vfree_helper(i8* %0) {
%2 = tail call i32 @printk(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @vfree(i8* %0)
ret void
}
double clamp(double x, double left, double right) {
  if (x < left) {
    return left;
  } else if (x > right) {
    return right;
  } else {
    return x;
  }
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1136 <clamp+0x36>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115f <clamp+0x5f>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1155 <clamp+0x55>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115f <clamp+0x5f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
minsd  %xmm0,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm2,%xmm3
andpd  %xmm1,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @clamp(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fcmp olt double %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load double, double* %6
store double %12, double* %4
br label %21
13: ; preds = %3
%14 = load double, double* %5
%15 = load double, double* %7
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load double, double* %7
store double %18, double* %4
br label %21
19: ; preds = %13
%20 = load double, double* %5
store double %20, double* %4
br label %21
21: ; preds = %19, %17, %11
%22 = load double, double* %4
ret double %22
}

LLVM IR (-O2):
define double @clamp(double %0, double %1, double %2) {
%4 = fcmp olt double %0, %1
%5 = fcmp ogt double %0, %2
%6 = select i1 %5, double %2, double %0
%7 = select i1 %4, double %1, double %6
ret double %7
}