xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
scalar_t__ pread(int, void *, int, int /*<<< orphan*/);
int main() {
  char *filename = "/mnt/test/test.txt";
  void *buf;
  int fd = open(filename, O_RDONLY);
  ssize_t rcode = pread(fd, buf, 100, 0);
  if (rcode < 0) {
    return rcode;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1040 <pread@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jge    117d <main+0x5d>
mov    -0x28(%rbp),%rax
mov    %eax,-0x4(%rbp)
jmp    1184 <main+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <open@plt>
mov    %eax,%edi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1040 <pread@plt>
mov    %rax,%rcx
sar    $0x3f,%rcx
and    %eax,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"/mnt/test/test.txt\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
store i32 0, i32* %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %2
%6 = load i8*, i8** %2
%7 = load i32, i32* @O_RDONLY
%8 = call i32 @open(i8* %6, i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = load i8*, i8** %3
%11 = call i64 @pread(i32 %9, i8* %10, i32 100, i32 0)
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = load i64, i64* %5
%16 = trunc i64 %15 to i32
store i32 %16, i32* %1
br label %18
17: ; preds = %0
store i32 0, i32* %1
br label %18
18: ; preds = %17, %14
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [19 x i8] c"/mnt/test/test.txt\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i64 @pread(i32 %2, i8* undef, i32 100, i32 0)
%4 = icmp slt i64 %3, 0
%5 = select i1 %4, i64 %3, i64 0
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ UPnPResponse_RenderingControl_SetLoudness(void *);
int /*<<< orphan*/ printf(char *, unsigned int, char *, int);
void UPnPRenderingControl_SetLoudness(void *upnptoken, unsigned int InstanceID,
                                      char *Channel, int DesiredLoudness) {
  printf("Invoke: UPnPRenderingControl_SetLoudness(%u,%s,%d);\r\n", InstanceID,
         Channel, DesiredLoudness);
  UPnPResponse_RenderingControl_SetLoudness(upnptoken);
}


x86 assembly (clang, -O0):
<UPnPRenderingControl_SetLoudness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <UPnPResponse_RenderingControl_SetLoudness@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [54 x i8] c"Invoke: UPnPRenderingControl_SetLoudness(%u,%s,%d);\0D\0A\00"
define void @UPnPRenderingControl_SetLoudness(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %6
%10 = load i8*, i8** %7
%11 = load i32, i32* %8
%12 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %10, i32 %11)
%13 = load i8*, i8** %5
%14 = call i32 @UPnPResponse_RenderingControl_SetLoudness(i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"Invoke: UPnPRenderingControl_SetLoudness(%u,%s,%d);\0D\0A\00"
define void @UPnPRenderingControl_SetLoudness(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2, i32 %3)
%6 = tail call i32 @UPnPResponse_RenderingControl_SetLoudness(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
unsigned long djb_hash(int /*<<< orphan*/ *, int);
int wcslen(int /*<<< orphan*/ *);
unsigned long hash(wchar_t *key) {
  return djb_hash(key, wcslen(key) * sizeof(wchar_t));
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <wcslen@plt>
mov    -0x10(%rbp),%rdi
cltq
shl    $0x2,%rax
mov    %eax,%esi
call   1040 <djb_hash@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
push   %rbx
mov    %rdi,%rbx
call   1030 <wcslen@plt>
lea    0x0(,%rax,4),%esi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <djb_hash@plt>

LLVM IR (-O0):
define i64 @hash(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @wcslen(i32* %4)
%6 = sext i32 %5 to i64
%7 = mul i64 %6, 4
%8 = trunc i64 %7 to i32
%9 = call i64 @djb_hash(i32* %3, i32 %8)
ret i64 %9
}

LLVM IR (-O2):
define i64 @hash(i32* %0) {
%2 = tail call i32 @wcslen(i32* %0)
%3 = shl i32 %2, 2
%4 = tail call i64 @djb_hash(i32* %0, i32 %3)
ret i64 %4
}
void cable_parallel_phys_wait() {}


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

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

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

LLVM IR (-O2):
define void @cable_parallel_phys_wait() {
ret void
}
/* Variables and functions */
char *getPath2(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getUserGameDataDir();
char *getCacheDir() {
  static char *cache_dir = NULL;
  if (cache_dir == NULL)
    cache_dir = getPath2(getUserGameDataDir(), "cache");
  return cache_dir;
}


x86 assembly (clang, -O0):
<getCacheDir>:
push   %rbp
mov    %rsp,%rbp
cmpq   $0x0,0x2f0c(%rip)
jne    114e <getCacheDir+0x2e>
mov    $0x0,%al
call   1030 <getUserGameDataDir@plt>
mov    %eax,%edi
lea    0xebe(%rip),%rsi
call   1040 <getPath2@plt>
mov    %rax,0x2eea(%rip)
mov    0x2ee3(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCacheDir>:
push   %rax
mov    0x2f10(%rip),%rax
test   %rax,%rax
je     112f <getCacheDir+0xf>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <getUserGameDataDir@plt>
lea    0xec3(%rip),%rsi
mov    %eax,%edi
call   1040 <getPath2@plt>
mov    %rax,0x2eed(%rip)
pop    %rcx
ret

LLVM IR (-O0):
@getCacheDir.cache_dir = internal global i8* null
@.str = [6 x i8] c"cache\00"
define i8* @getCacheDir() {
%1 = load i8*, i8** @getCacheDir.cache_dir
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = call i32 (...) @getUserGameDataDir()
%5 = call i8* @getPath2(i32 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** @getCacheDir.cache_dir
br label %6
6: ; preds = %3, %0
%7 = load i8*, i8** @getCacheDir.cache_dir
ret i8* %7
}

LLVM IR (-O2):
@getCacheDir.cache_dir = internal unnamed_addr global i8* null
@.str = [6 x i8] c"cache\00"
define i8* @getCacheDir() {
%1 = load i8*, i8** @getCacheDir.cache_dir
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 (...) @getUserGameDataDir()
%5 = tail call i8* @getPath2(i32 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** @getCacheDir.cache_dir
br label %6
6: ; preds = %3, %0
%7 = phi i8* [ %5, %3 ], [ %1, %0 ]
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ foo(int);
int main() {
  if (foo(0x3fffffff) != 0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3fffffff,%edi
call   1040 <foo@plt>
cmp    $0x0,%rax
je     114a <main+0x2a>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3fffffff,%edi
call   1040 <foo@plt>
test   %rax,%rax
jne    1134 <main+0x14>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @foo(i32 1073741823)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @foo(i32 1073741823)
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
/* Variables and functions */
void *sbrk(int);
int sbrk_wrapper(int size) {
  void *pointer;
  pointer = sbrk(size);
  return (int)((int *)pointer);
}


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

x86 assembly (clang, -O2):
<sbrk_wrapper>:
jmp    1030 <sbrk@plt>

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

LLVM IR (-O2):
define i32 @sbrk_wrapper(i32 %0) {
%2 = tail call i8* @sbrk(i32 %0)
%3 = ptrtoint i8* %2 to i64
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct node *);
void node_free(struct node *n) { free(n); }


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

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

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

LLVM IR (-O2):
%struct.node = type { i32 }
define void @node_free(%struct.node* nocapture %0) {
%2 = tail call i32 @free(%struct.node* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ store(int /*<<< orphan*/ *, int, int, int, int);
void storeX(uint8_t *mem, uint64_t addr, uint64_t v, uint64_t hint) {
  store(mem, addr, v, (hint >> 3) & 0x3, hint & 0x7);
}


x86 assembly (clang, -O0):
<storeX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
sar    $0x3,%ecx
and    $0x3,%ecx
mov    -0x14(%rbp),%r8d
and    $0x7,%r8d
call   1030 <store@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<storeX>:
mov    %ecx,%r8d
shr    $0x3,%ecx
and    $0x3,%ecx
and    $0x7,%r8d
jmp    1030 <store@plt>

LLVM IR (-O0):
define void @storeX(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = ashr i32 %12, 3
%14 = and i32 %13, 3
%15 = load i32, i32* %8
%16 = and i32 %15, 7
%17 = call i32 @store(i32* %9, i32 %10, i32 %11, i32 %14, i32 %16)
ret void
}

LLVM IR (-O2):
define void @storeX(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = lshr i32 %3, 3
%6 = and i32 %5, 3
%7 = and i32 %3, 7
%8 = tail call i32 @store(i32* %0, i32 %1, i32 %2, i32 %6, i32 %7)
ret void
}
/* Variables and functions */
char getchar();
void getchars(char *start, int count) {
  if (count > 0) {
    char c = getchar();
    *start = c;
    getchars(start + 1, count - 1);
  }
}


x86 assembly (clang, -O0):
<getchars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    115f <getchars+0x3f>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <getchars@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchars>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    1135 <getchars+0x25>
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%ebp
nop
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1120 <getchars+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @getchars(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = call signext i8 (...) @getchar()
store i8 %9, i8* %5
%10 = load i8, i8* %5
%11 = load i8*, i8** %3
store i8 %10, i8* %11
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1
br label %16
16: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
define void @getchars(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2, %4
%5 = phi i32 [ %9, %4 ], [ %1, %2 ]
%6 = phi i8* [ %8, %4 ], [ %0, %2 ]
%7 = tail call signext i8 (...) @getchar()
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = add nsw i32 %5, -1
%10 = icmp ugt i32 %5, 1
br i1 %10, label %4, label %11
11: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ checktty(int /*<<< orphan*/, char *);
int main(void) {
  checktty(STDIN_FILENO, "stdin");
  checktty(STDOUT_FILENO, "stdout");
  checktty(STDERR_FILENO, "stderr");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <checktty@plt>
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1030 <checktty@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1030 <checktty@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <checktty@plt>
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
call   1030 <checktty@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
call   1030 <checktty@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@.str = [6 x i8] c"stdin\00"
@STDOUT_FILENO = global i32 0
@.str.1 = [7 x i8] c"stdout\00"
@STDERR_FILENO = global i32 0
@.str.2 = [7 x i8] c"stderr\00"
define i32 @main() {
%1 = load i32, i32* @STDIN_FILENO
%2 = call i32 @checktty(i32 %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @STDOUT_FILENO
%4 = call i32 @checktty(i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @STDERR_FILENO
%6 = call i32 @checktty(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@.str = [6 x i8] c"stdin\00"
@STDOUT_FILENO = global i32 0
@.str.1 = [7 x i8] c"stdout\00"
@STDERR_FILENO = global i32 0
@.str.2 = [7 x i8] c"stderr\00"
define i32 @main() {
%1 = load i32, i32* @STDIN_FILENO
%2 = tail call i32 @checktty(i32 %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @STDOUT_FILENO
%4 = tail call i32 @checktty(i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @STDERR_FILENO
%6 = tail call i32 @checktty(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct auth_engine {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct auth_engine *);
void auth_destroy(struct auth_engine *auth) { free(auth); }


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

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

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

LLVM IR (-O2):
%struct.auth_engine = type { i32 }
define void @auth_destroy(%struct.auth_engine* nocapture %0) {
%2 = tail call i32 @free(%struct.auth_engine* %0)
ret void
}
void XCreateOC() {}


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

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

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

LLVM IR (-O2):
define void @XCreateOC() {
ret void
}
int octdigval(int c) {
  int val = -1;
  if ((c >= '0') && (c <= '7')) {
    val = c - '0';
  }
  return val;
}


x86 assembly (clang, -O0):
<octdigval>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
cmpl   $0x30,-0x4(%rbp)
jl     112b <octdigval+0x2b>
cmpl   $0x37,-0x4(%rbp)
jg     112b <octdigval+0x2b>
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<octdigval>:
lea    -0x30(%rdi),%ecx
mov    %edi,%eax
and    $0xfffffff8,%eax
cmp    $0x30,%eax
mov    $0xffffffff,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @octdigval(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 -1, i32* %3
%4 = load i32, i32* %2
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 55
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 48
store i32 %11, i32* %3
br label %12
12: ; preds = %9, %6, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @octdigval(i32 %0) {
%2 = and i32 %0, -8
%3 = icmp eq i32 %2, 48
%4 = add nsw i32 %0, -48
%5 = select i1 %3, i32 %4, i32 -1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ CameraStabSettingsHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void CameraStabSettingsUpdated() { UAVObjUpdated(CameraStabSettingsHandle()); }


x86 assembly (clang, -O0):
<CameraStabSettingsUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <CameraStabSettingsHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CameraStabSettingsUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <CameraStabSettingsHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @CameraStabSettingsUpdated() {
%1 = call i32 (...) @CameraStabSettingsHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @CameraStabSettingsUpdated() {
%1 = tail call i32 (...) @CameraStabSettingsHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
/* Type definitions */
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ select(int /*<<< orphan*/, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          struct timeval *);
int get_cmd(char *buf, int buf_size) {
  int ret;
  struct timeval tval;
  tval.tv_sec = 0;
  tval.tv_usec = 100 * 1000;
  ret = read(0, buf, buf_size);
  select(0, NULL, NULL, NULL, &tval);
  return 0;
}


x86 assembly (clang, -O0):
<get_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x186a0,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
xor    %edi,%edi
call   1030 <read@plt>
mov    %eax,-0x10(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x20(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1040 <select@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_cmd>:
sub    $0x18,%rsp
mov    %esi,%edx
mov    %rdi,%rsi
movq   $0x0,0x10(%rsp)
movl   $0x186a0,0x8(%rsp)
xor    %edi,%edi
call   1030 <read@plt>
lea    0x8(%rsp),%r8
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <select@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i32 @get_cmd(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.timeval
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
store i64 0, i64* %7
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
store i32 100000, i32* %8
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = call i32 @read(i32 0, i8* %9, i32 %10)
store i32 %11, i32* %5
%12 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %6)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i32 @get_cmd(i8* nocapture %0, i32 %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
store i32 100000, i32* %6
%7 = tail call i32 @read(i32 0, i8* %0, i32 %1)
%8 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %3)
ret i32 0
}
int ttyname() {
  printf("%s unimplemented\n", __FUNCTION__);
  return -1;
}


x86 assembly (clang, -O0):
<ttyname>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xef0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.ttyname = [8 x i8] c"ttyname\00"
define i32 @ttyname() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__FUNCTION__.ttyname, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.ttyname = [8 x i8] c"ttyname\00"
define i32 @ttyname() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__FUNCTION__.ttyname, i64 0, i64 0))
ret i32 -1
}
void loadContent() {}


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

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

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

LLVM IR (-O2):
define void @loadContent() {
ret void
}
/* Variables and functions */
int MAXPATHLEN;
size_t atoi(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  char b[MAXPATHLEN];
  size_t len = atoi(argv[1]);
  (void)printf("%s\n", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    -0x30(%rbp),%rsi
mov    %rax,-0x28(%rbp)
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rsi
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,%rsp
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
@MAXPATHLEN = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* @MAXPATHLEN
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %6
%12 = alloca i8, i64 %10
store i64 %10, i64* %7
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @atoi(i8* %15)
store i64 %16, i64* %8
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 0, i32* %3
%18 = load i8*, i8** %6
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@MAXPATHLEN = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @MAXPATHLEN
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}
const char *tvheadend_dataroot(void) { return "./"; }


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"./\00"
define i8* @tvheadend_dataroot() {
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [3 x i8] c"./\00"
define i8* @tvheadend_dataroot() {
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int is_valid_in_SecAltIDGrp(size_t __tag) {
  switch (__tag) {
  case 455:
  case 456:
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<is_valid_in_SecAltIDGrp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffe39,%rax
sub    $0x1,%rax
ja     112d <is_valid_in_SecAltIDGrp+0x2d>
jmp    1121 <is_valid_in_SecAltIDGrp+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1134 <is_valid_in_SecAltIDGrp+0x34>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_in_SecAltIDGrp>:
add    $0xfffffffffffffe39,%rdi
xor    %eax,%eax
cmp    $0x2,%rdi
setb   %al
ret

LLVM IR (-O0):
define i32 @is_valid_in_SecAltIDGrp(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
switch i64 %4, label %6 [
i64 455, label %5
i64 456, label %5
]
5: ; preds = %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_valid_in_SecAltIDGrp(i64 %0) {
%2 = add i64 %0, -455
%3 = icmp ult i64 %2, 2
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int __PHYSFS_platformIsDirectory(char const *);
int DIR_isArchive(const char *filename, int forWriting) {
  return (__PHYSFS_platformIsDirectory(filename));
}


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

x86 assembly (clang, -O2):
<DIR_isArchive>:
jmp    1030 <__PHYSFS_platformIsDirectory@plt>

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

LLVM IR (-O2):
define i32 @DIR_isArchive(i8* %0, i32 %1) {
%3 = tail call i32 @__PHYSFS_platformIsDirectory(i8* %0)
ret i32 %3
}
char *copyin(char *src, char **space) {
  char *cp;
  char *top;
  top = cp = *space;
  while ((*cp++ = *src++) != '\0')
    ;
  *space = cp;
  return (top);
}


x86 assembly (clang, -O0):
<copyin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     114e <copyin+0x4e>
jmp    111b <copyin+0x1b>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyin>:
mov    (%rsi),%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rdi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <copyin+0x10>
add    %rax,%rcx
mov    %rcx,(%rsi)
ret

LLVM IR (-O0):
define i8* @copyin(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8** %1, i8*** %4
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
store i8* %8, i8** %5
store i8* %8, i8** %6
br label %9
9: ; preds = %17, %2
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
%12 = load i8, i8* %10
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %5
store i8 %12, i8* %13
%15 = sext i8 %12 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %9
br label %9
18: ; preds = %9
%19 = load i8*, i8** %5
%20 = load i8**, i8*** %4
store i8* %19, i8** %20
%21 = load i8*, i8** %6
ret i8* %21
}

LLVM IR (-O2):
define i8* @copyin(i8* nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
br label %4
4: ; preds = %4, %2
%5 = phi i8* [ %3, %2 ], [ %9, %4 ]
%6 = phi i8* [ %0, %2 ], [ %7, %4 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %6
%9 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %8, i8* %5
%10 = icmp eq i8 %8, 0
br i1 %10, label %11, label %4
11: ; preds = %4
store i8* %9, i8** %1
ret i8* %3
}
__uint128_t almost_mersenne_modulo(__uint128_t x) {
  const int power = 89;
  const __uint128_t prime = ((__uint128_t)(1) << power) - 1;
  return (x & prime) + (x >> power);
}


x86 assembly (clang, -O0):
<almost_mersenne_modulo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
movl   $0x59,-0x34(%rbp)
movq   $0x1ffffff,-0x48(%rbp)
01
movq   $0xffffffffffffffff,-0x50(%rbp)
ff
mov    -0x30(%rbp),%rcx
mov    -0x28(%rbp),%rdx
mov    %edx,%eax
and    $0x1ffffff,%eax
shr    $0x19,%rdx
add    %rdx,%rcx
adc    $0x0,%rax
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<almost_mersenne_modulo>:
mov    %rsi,%rax
mov    %eax,%edx
and    $0x1ffffff,%edx
shr    $0x19,%rax
add    %rdi,%rax
adc    $0x0,%rdx
ret

LLVM IR (-O0):
define { i64, i64 } @almost_mersenne_modulo(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i32
%7 = alloca i128
%8 = bitcast i128* %4 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = load i128, i128* %4
store i128 %11, i128* %5
store i32 89, i32* %6
store i128 618970019642690137449562111, i128* %7
%12 = load i128, i128* %5
%13 = and i128 %12, 618970019642690137449562111
%14 = load i128, i128* %5
%15 = lshr i128 %14, 89
%16 = add i128 %13, %15
store i128 %16, i128* %3
%17 = bitcast i128* %3 to { i64, i64 }*
%18 = load { i64, i64 }, { i64, i64 }* %17
ret { i64, i64 } %18
}

LLVM IR (-O2):
define { i64, i64 } @almost_mersenne_modulo(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = and i128 %4, 618970001195946063740010496
%7 = or i128 %6, %5
%8 = lshr i128 %3, 25
%9 = add nuw nsw i128 %7, %8
%10 = trunc i128 %9 to i64
%11 = lshr i128 %9, 64
%12 = trunc i128 %11 to i64
%13 = insertvalue { i64, i64 } poison, i64 %10, 0
%14 = insertvalue { i64, i64 } %13, i64 %12, 1
ret { i64, i64 } %14
}
/* Variables and functions */
int /*<<< orphan*/ run(int);
int main() {
  run(1);
  run(2);
  run(3);
  run(10);
  run(20);
  run(40);
  run(60);
  run(80);
  run(100);
  run(200);
  run(400);
  run(800);
  run(1000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <run@plt>
mov    $0x2,%edi
call   1030 <run@plt>
mov    $0x3,%edi
call   1030 <run@plt>
mov    $0xa,%edi
call   1030 <run@plt>
mov    $0x14,%edi
call   1030 <run@plt>
mov    $0x28,%edi
call   1030 <run@plt>
mov    $0x3c,%edi
call   1030 <run@plt>
mov    $0x50,%edi
call   1030 <run@plt>
mov    $0x64,%edi
call   1030 <run@plt>
mov    $0xc8,%edi
call   1030 <run@plt>
mov    $0x190,%edi
call   1030 <run@plt>
mov    $0x320,%edi
call   1030 <run@plt>
mov    $0x3e8,%edi
call   1030 <run@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <run@plt>
mov    $0x2,%edi
call   1030 <run@plt>
mov    $0x3,%edi
call   1030 <run@plt>
mov    $0xa,%edi
call   1030 <run@plt>
mov    $0x14,%edi
call   1030 <run@plt>
mov    $0x28,%edi
call   1030 <run@plt>
mov    $0x3c,%edi
call   1030 <run@plt>
mov    $0x50,%edi
call   1030 <run@plt>
mov    $0x64,%edi
call   1030 <run@plt>
mov    $0xc8,%edi
call   1030 <run@plt>
mov    $0x190,%edi
call   1030 <run@plt>
mov    $0x320,%edi
call   1030 <run@plt>
mov    $0x3e8,%edi
call   1030 <run@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @run(i32 1)
%3 = call i32 @run(i32 2)
%4 = call i32 @run(i32 3)
%5 = call i32 @run(i32 10)
%6 = call i32 @run(i32 20)
%7 = call i32 @run(i32 40)
%8 = call i32 @run(i32 60)
%9 = call i32 @run(i32 80)
%10 = call i32 @run(i32 100)
%11 = call i32 @run(i32 200)
%12 = call i32 @run(i32 400)
%13 = call i32 @run(i32 800)
%14 = call i32 @run(i32 1000)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @run(i32 1)
%2 = tail call i32 @run(i32 2)
%3 = tail call i32 @run(i32 3)
%4 = tail call i32 @run(i32 10)
%5 = tail call i32 @run(i32 20)
%6 = tail call i32 @run(i32 40)
%7 = tail call i32 @run(i32 60)
%8 = tail call i32 @run(i32 80)
%9 = tail call i32 @run(i32 100)
%10 = tail call i32 @run(i32 200)
%11 = tail call i32 @run(i32 400)
%12 = tail call i32 @run(i32 800)
%13 = tail call i32 @run(i32 1000)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int testDivByZero() {
  int x;
  scanf("%d", &x);
  return 5 / x;
}


x86 assembly (clang, -O0):
<testDivByZero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <scanf@plt>
mov    $0x5,%eax
cltd
idivl  -0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testDivByZero>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>
mov    $0x5,%eax
xor    %edx,%edx
idivl  0x4(%rsp)
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @testDivByZero() {
%1 = alloca i32
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
%4 = sdiv i32 5, %3
ret i32 %4
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @testDivByZero() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = sdiv i32 5, %4
ret i32 %5
}
void sigchild(int sig) { (void)sig; }


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

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

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

LLVM IR (-O2):
define void @sigchild(i32 %0) {
ret void
}
int compute_func2(int m) { return (m * 3); }


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

x86 assembly (clang, -O2):
<compute_func2>:
lea    (%rdi,%rdi,2),%eax
ret

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

LLVM IR (-O2):
define i32 @compute_func2(i32 %0) {
%2 = mul nsw i32 %0, 3
ret i32 %2
}
/* Variables and functions */
float M_PI_2;
float sin(float);
float sineEaseOutf(float p) { return sin(p * M_PI_2); }


x86 assembly (clang, -O0):
<sineEaseOutf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mov    0x2ebf(%rip),%rax
mulss  (%rax),%xmm0
call   1030 <sin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sineEaseOutf>:
mov    0x2ed1(%rip),%rax
mulss  (%rax),%xmm0
jmp    1030 <sin@plt>

LLVM IR (-O0):
@M_PI_2 = global float 0.000000e+00
define float @sineEaseOutf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* @M_PI_2
%5 = fmul float %3, %4
%6 = call float @sin(float %5)
ret float %6
}

LLVM IR (-O2):
@M_PI_2 = global float 0.000000e+00
define float @sineEaseOutf(float %0) {
%2 = load float, float* @M_PI_2
%3 = fmul float %2, %0
%4 = tail call float @sin(float %3)
ret float %4
}
void ab8500_fg_test_init(struct ab8500_fg *di) { return; }


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
%struct.ab8500_fg = type opaque
define void @ab8500_fg_test_init(%struct.ab8500_fg* nocapture %0) {
ret void
}
/* Type definitions */
typedef scalar_t__ ulong;

/* Variables and functions */
ulong umuldiv(ulong a, ulong b, ulong c) {
  double d;
  d = ((double)a * (double)b) / (double)c;
  if (d >= 4294967295.)
    d = 4294967295.;
  return (ulong)d;
}


x86 assembly (clang, -O0):
<umuldiv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdq -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xec4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1153 <umuldiv+0x53>
movsd  0xeb2(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<umuldiv>:
cvtsi2sd %rdi,%xmm0
cvtsi2sd %rsi,%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %rdx,%xmm0
divsd  %xmm0,%xmm1
movsd  0xede(%rip),%xmm0
minsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
ret

LLVM IR (-O0):
define i64 @umuldiv(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca double
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %4
%9 = sitofp i64 %8 to double
%10 = load i64, i64* %5
%11 = sitofp i64 %10 to double
%12 = fmul double %9, %11
%13 = load i64, i64* %6
%14 = sitofp i64 %13 to double
%15 = fdiv double %12, %14
store double %15, double* %7
%16 = load double, double* %7
%17 = fcmp oge double %16, 0x41EFFFFFFFE00000
br i1 %17, label %18, label %19
18: ; preds = %3
store double 0x41EFFFFFFFE00000, double* %7
br label %19
19: ; preds = %18, %3
%20 = load double, double* %7
%21 = fptosi double %20 to i64
ret i64 %21
}

LLVM IR (-O2):
define i64 @umuldiv(i64 %0, i64 %1, i64 %2) {
%4 = sitofp i64 %0 to double
%5 = sitofp i64 %1 to double
%6 = fmul double %4, %5
%7 = sitofp i64 %2 to double
%8 = fdiv double %6, %7
%9 = fcmp oge double %8, 0x41EFFFFFFFE00000
%10 = select i1 %9, double 0x41EFFFFFFFE00000, double %8
%11 = fptosi double %10 to i64
ret i64 %11
}
int word_length(char const *s, char c, int i) {
  int start;
  start = i;
  while (s[i] && s[i] != c) {
    i++;
  }
  return (i - start);
}


x86 assembly (clang, -O0):
<word_length>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     1149 <word_length+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1159 <word_length+0x59>
jmp    1167 <word_length+0x67>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1117 <word_length+0x17>
mov    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<word_length>:
movslq %edx,%rcx
add    %rdi,%rcx
mov    $0xffffffff,%eax
nopl   0x0(%rax,%rax,1)
movzbl (%rcx),%edx
add    $0x1,%eax
test   %dl,%dl
je     1123 <word_length+0x23>
add    $0x1,%rcx
cmp    %sil,%dl
jne    1110 <word_length+0x10>
ret

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

LLVM IR (-O2):
define i32 @word_length(i8* nocapture %0, i8 signext %1, i32 %2) {
%4 = sext i32 %2 to i64
br label %5
5: ; preds = %5, %3
%6 = phi i64 [ %12, %5 ], [ %4, %3 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
%10 = icmp eq i8 %8, %1
%11 = or i1 %9, %10
%12 = add i64 %6, 1
br i1 %11, label %13, label %5
13: ; preds = %5
%14 = trunc i64 %6 to i32
%15 = sub nsw i32 %14, %2
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int main(void) {
  int a = 34;
  int b = rand() % 0;
  printf("%d\n", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x22,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
xor    %ecx,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <rand@plt>
lea    0xed1(%rip),%rdi
call   1030 <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
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 34, i32* %2
%4 = call i32 (...) @rand()
%5 = srem i32 %4, 0
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @rand()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 poison)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void afficheLigne(int nbColonnes, char motif) {
  for (int iCol = 0; iCol < nbColonnes; iCol = iCol + 1) {
    printf("%c", motif);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<afficheLigne>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1154 <afficheLigne+0x44>
movsbl -0x5(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <afficheLigne+0x18>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<afficheLigne>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    112c <afficheLigne+0x1c>
mov    %edi,%ebx
movsbl %sil,%ebp
nopl   (%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <afficheLigne+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @afficheLigne(i32 %0, i8 signext %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = sext i8 %1 to i32
br label %8
6: ; preds = %8, %2
%7 = tail call i32 @putchar(i32 10)
ret void
8: ; preds = %4, %8
%9 = phi i32 [ 0, %4 ], [ %11, %8 ]
%10 = tail call i32 @putchar(i32 %5)
%11 = add nuw nsw i32 %9, 1
%12 = icmp eq i32 %11, %0
br i1 %12, label %6, label %8
}
/* Type definitions */
typedef int /*<<< orphan*/ mtx_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_mutex_destroy(int /*<<< orphan*/ *);
void mtx_destroy(mtx_t *mtx) { pthread_mutex_destroy(mtx); }


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

x86 assembly (clang, -O2):
<mtx_destroy>:
jmp    1030 <pthread_mutex_destroy@plt>

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

LLVM IR (-O2):
define void @mtx_destroy(i32* %0) {
%2 = tail call i32 @pthread_mutex_destroy(i32* %0)
ret void
}