xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, char *);
int8_t(cli_unknown)(char *response, size_t respLen, int argc, char *argv[],
                    void *opts) {
  snprintf(
      response, respLen,
      "Unknown command \"%s\". Type \"help\" or \"?\" to see valid commands."
      "\n",
      argv[0]);
  return 0;
}


x86 assembly (clang, -O0):
<cli_unknown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
lea    0xebf(%rip),%rdx
call   1030 <snprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [65 x i8] c"Unknown command \22%s\22. Type \22help\22 or \22?\22 to see valid commands.\0A\00"
define i32 @cli_unknown(i8* %0, i64 %1, i32 %2, i8** %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i8*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i32 %2, i32* %8
store i8** %3, i8*** %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i64, i64* %7
%13 = load i8**, i8*** %9
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @snprintf(i8* %11, i64 %12, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [65 x i8] c"Unknown command \22%s\22. Type \22help\22 or \22?\22 to see valid commands.\0A\00"
define i32 @cli_unknown(i8* %0, i64 %1, i32 %2, i8** nocapture %3, i8* nocapture readnone %4) {
%6 = load i8*, i8** %3
%7 = tail call i32 @snprintf(i8* %0, i64 %1, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ reuseON;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int srcUdpSocket_client() {
  int socketFD = socket(AF_INET, SOCK_DGRAM, 0);
  int reuseON = 1;
  setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseON, sizeof(reuseON));
  return socketFD;
}


x86 assembly (clang, -O0):
<srcUdpSocket_client>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <socket@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
mov    0x2e6a(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srcUdpSocket_client>:
push   %rbx
sub    $0x10,%rsp
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <socket@plt>
mov    %eax,%ebx
movl   $0x1,0xc(%rsp)
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
mov    0x2e70(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rcx
mov    %ebx,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @srcUdpSocket_client() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @AF_INET
%4 = load i32, i32* @SOCK_DGRAM
%5 = call i32 @socket(i32 %3, i32 %4, i32 0)
store i32 %5, i32* %1
store i32 1, i32* %2
%6 = load i32, i32* %1
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_REUSEADDR
%9 = call i32 @setsockopt(i32 %6, i32 %7, i32 %8, i32* %2, i32 4)
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @srcUdpSocket_client() {
%1 = alloca i32
%2 = load i32, i32* @AF_INET
%3 = load i32, i32* @SOCK_DGRAM
%4 = tail call i32 @socket(i32 %2, i32 %3, i32 0)
%5 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_REUSEADDR
%8 = call i32 @setsockopt(i32 %4, i32 %6, i32 %7, i32* %1, i32 4)
ret i32 %4
}
void BSXDecodePair(unsigned char in, char *out) {
  static char hexify[] = "0123456789ABCDEF";
  *out++ = hexify[in / 16];
  *out = hexify[in & 0x0F];
}


x86 assembly (clang, -O0):
<BSXDecodePair>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
lea    0x2f0c(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0x2ee7(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSXDecodePair>:
mov    %edi,%eax
mov    %rax,%rcx
shr    $0x4,%rcx
lea    0xef0(%rip),%rdx
mov    (%rcx,%rdx,1),%cl
mov    %cl,(%rsi)
and    $0xf,%eax
mov    (%rax,%rdx,1),%al
mov    %al,0x1(%rsi)
ret

LLVM IR (-O0):
@BSXDecodePair.hexify = internal global [17 x i8] c"0123456789ABCDEF\00"
define void @BSXDecodePair(i8 zeroext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
store i8 %0, i8* %3
store i8* %1, i8** %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = sdiv i32 %6, 16
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [17 x i8], [17 x i8]* @BSXDecodePair.hexify, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %4
store i8 %10, i8* %11
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = and i32 %14, 15
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [17 x i8], [17 x i8]* @BSXDecodePair.hexify, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %4
store i8 %18, i8* %19
ret void
}

LLVM IR (-O2):
@BSXDecodePair.hexify = internal unnamed_addr constant [17 x i8] c"0123456789ABCDEF\00"
define void @BSXDecodePair(i8 zeroext %0, i8* nocapture writeonly %1) {
%3 = zext i8 %0 to i32
%4 = lshr i32 %3, 4
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds [17 x i8], [17 x i8]* @BSXDecodePair.hexify, i64 0, i64 %5
%7 = load i8, i8* %6
%8 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %7, i8* %1
%9 = and i32 %3, 15
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds [17 x i8], [17 x i8]* @BSXDecodePair.hexify, i64 0, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GETVAL;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int semctl(int, int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int sem_get(int id) {
  int rval;
  if ((rval = semctl(id, 0, GETVAL, NULL)) == -1) {
    fprintf(stderr, "Error: semaphore konnte nicht gelesen werden\n");
    exit(-1);
  }
  return rval;
}


x86 assembly (clang, -O0):
<sem_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e93(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%ecx
call   1040 <semctl@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    117d <sem_get+0x4d>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_get>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1040 <semctl@plt>
cmp    $0xffffffff,%eax
je     114a <sem_get+0x1a>
pop    %rcx
ret
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@GETVAL = global i32 0
@stderr = global i32 0
@.str = [46 x i8] c"Error: semaphore konnte nicht gelesen werden\0A\00"
define i32 @sem_get(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @GETVAL
%6 = call i32 @semctl(i32 %4, i32 0, i32 %5, i32* null)
store i32 %6, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@GETVAL = global i32 0
@stderr = global i32 0
@.str = [46 x i8] c"Error: semaphore konnte nicht gelesen werden\0A\00"
define i32 @sem_get(i32 %0) {
%2 = load i32, i32* @GETVAL
%3 = tail call i32 @semctl(i32 %0, i32 0, i32 %2, i32* null)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %1
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
long long __infer_nondet_long_long_int();
long long int wcstoll(const wchar_t *nptr, wchar_t **endptr, int base) {
  return __infer_nondet_long_long_int();
}


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

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

LLVM IR (-O0):
define i64 @wcstoll(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 = call i64 (...) @__infer_nondet_long_long_int()
ret i64 %7
}

LLVM IR (-O2):
define i64 @wcstoll(i32* nocapture readnone %0, i32** nocapture readnone %1, i32 %2) {
%4 = tail call i64 (...) @__infer_nondet_long_long_int()
ret i64 %4
}
/* Variables and functions */
int *malloc(int);
void outAlloc(int n, int **arr) { *arr = malloc(n * sizeof(int)); }


x86 assembly (clang, -O0):
<outAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outAlloc>:
push   %rbx
mov    %rsi,%rbx
shl    $0x2,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @outAlloc(i32 %0, i32** %1) {
%3 = alloca i32
%4 = alloca i32**
store i32 %0, i32* %3
store i32** %1, i32*** %4
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = mul i64 %6, 4
%8 = trunc i64 %7 to i32
%9 = call i32* @malloc(i32 %8)
%10 = load i32**, i32*** %4
store i32* %9, i32** %10
ret void
}

LLVM IR (-O2):
define void @outAlloc(i32 %0, i32** nocapture writeonly %1) {
%3 = shl i32 %0, 2
%4 = tail call i32* @malloc(i32 %3)
store i32* %4, i32** %1
ret void
}
void g_signal_emitv() {}


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

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

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

LLVM IR (-O2):
define void @g_signal_emitv() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int usage(void) {
  fprintf(stderr, "Usage: fork <nb_fork>\n");
  return 1;
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"Usage: fork <nb_fork>\0A\00"
define i32 @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"Usage: fork <nb_fork>\0A\00"
define i32 @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 1
}
void fa148(int n) {
  {
    int b[n];
    {
      int c[n];
      0;
    }
    {
      int d[n];
      0;
    };
    int e[n];
    0;
  };
  {
    int f[n];
    goto a;
    {
      int g[n];
      0;
    };
    {
      int h[n];
      0;
    };
  a:;
    int i[n];
    0;
  };
  ;
  int j[n];
  0;
}


x86 assembly (clang, -O0):
<fa148>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rax,-0x50(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x78(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x80(%rbp)
mov    %rax,-0x88(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @fa148(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i64
store i32 %0, i32* %2
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %3
%22 = alloca i32, i64 %20
store i64 %20, i64* %4
%23 = load i32, i32* %2
%24 = zext i32 %23 to i64
%25 = call i8* @llvm.stacksave()
store i8* %25, i8** %5
%26 = alloca i32, i64 %24
store i64 %24, i64* %6
%27 = load i8*, i8** %5
%28 = load i32, i32* %2
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
store i8* %30, i8** %7
%31 = alloca i32, i64 %29
store i64 %29, i64* %8
%32 = load i8*, i8** %7
%33 = load i32, i32* %2
%34 = zext i32 %33 to i64
%35 = alloca i32, i64 %34
store i64 %34, i64* %9
%36 = load i8*, i8** %3
%37 = load i32, i32* %2
%38 = zext i32 %37 to i64
%39 = call i8* @llvm.stacksave()
store i8* %39, i8** %10
%40 = alloca i32, i64 %38
store i64 %38, i64* %11
br label %52
41: ; No predecessors!
%42 = load i32, i32* %2
%43 = zext i32 %42 to i64
%44 = call i8* @llvm.stacksave()
store i8* %44, i8** %12
%45 = alloca i32, i64 %43
store i64 %43, i64* %13
%46 = load i8*, i8** %12
%47 = load i32, i32* %2
%48 = zext i32 %47 to i64
%49 = call i8* @llvm.stacksave()
store i8* %49, i8** %14
%50 = alloca i32, i64 %48
store i64 %48, i64* %15
%51 = load i8*, i8** %14
br label %52
52: ; preds = %41, %1
%53 = load i32, i32* %2
%54 = zext i32 %53 to i64
%55 = alloca i32, i64 %54
store i64 %54, i64* %16
%56 = load i8*, i8** %10
%57 = load i32, i32* %2
%58 = zext i32 %57 to i64
%59 = call i8* @llvm.stacksave()
store i8* %59, i8** %17
%60 = alloca i32, i64 %58
store i64 %58, i64* %18
%61 = load i8*, i8** %17
ret void
}

LLVM IR (-O2):
define void @fa148(i32 %0) {
ret void
}
/* Variables and functions */
char *my_alloc1(int);
int test1(int len) {
  int i;
  char *p = my_alloc1(len);
  return ((long int)p) & 31;
}


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

x86 assembly (clang, -O2):
<test1>:
push   %rax
call   1030 <my_alloc1@plt>
and    $0x1f,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i8* @my_alloc1(i32 %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i64
%9 = and i64 %8, 31
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @test1(i32 %0) {
%2 = tail call i8* @my_alloc1(i32 %0)
%3 = ptrtoint i8* %2 to i64
%4 = trunc i64 %3 to i32
%5 = and i32 %4, 31
ret i32 %5
}
/* Variables and functions */
long meat_time_find_begin_of_month(long);
long meat_time_find_middle_of_month(long const, int);
signed long int meat_time_find_end_of_month(signed long int const i_now) {
  signed long int i_middle_of_next_month;
  i_middle_of_next_month = meat_time_find_middle_of_month(i_now, 1);
  return meat_time_find_begin_of_month(i_middle_of_next_month);
}


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

x86 assembly (clang, -O2):
<meat_time_find_end_of_month>:
push   %rax
mov    $0x1,%esi
call   1030 <meat_time_find_middle_of_month@plt>
mov    %rax,%rdi
pop    %rax
jmp    1040 <meat_time_find_begin_of_month@plt>

LLVM IR (-O0):
define i64 @meat_time_find_end_of_month(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 @meat_time_find_middle_of_month(i64 %4, i32 1)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = call i64 @meat_time_find_begin_of_month(i64 %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @meat_time_find_end_of_month(i64 %0) {
%2 = tail call i64 @meat_time_find_middle_of_month(i64 %0, i32 1)
%3 = tail call i64 @meat_time_find_begin_of_month(i64 %2)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pthread_exit(void *);
int /*<<< orphan*/ sleep(int);
void *run(void *arg) {
  printf("Freedom is nothing but a chance to be better\n");
  sleep(1);
  printf(
      "Debugging involves backwards reasoning, like solving murder mysteries.\n"
      "Something impossible occurred, and the only solid information is that "
      "it "
      "really did occur.\n");
  pthread_exit((void *)2);
}


x86 assembly (clang, -O0):
<run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"Freedom is nothing but a chance to be better\0A\00"
@.str.1 = [163 x i8] c"Debugging involves backwards reasoning, like solving murder mysteries.\0ASomething impossible occurred, and the only solid information is that it really did occur.\0A\00"
define i8* @run(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @sleep(i32 1)
%6 = call i32 @printf(i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @pthread_exit(i8* inttoptr (i64 2 to i8*))
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
@str = [45 x i8] c"Freedom is nothing but a chance to be better\00"
@str.2 = [162 x i8] c"Debugging involves backwards reasoning, like solving murder mysteries.\0ASomething impossible occurred, and the only solid information is that it really did occur.\00"
define noalias i8* @run(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([162 x i8], [162 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 @pthread_exit(i8* inttoptr (i64 2 to i8*))
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ upd_img0(float, float, int *);
void upd_img(float x, float y, float z, float x0, float y0, float z0, int *ix,
             int *iy, int *iz) {
  upd_img0(x, x0, ix);
  upd_img0(y, y0, iy);
  upd_img0(z, z0, iz);
}


x86 assembly (clang, -O0):
<upd_img>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
mov    -0x20(%rbp),%rdi
call   1030 <upd_img0@plt>
movss  -0x8(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
mov    -0x28(%rbp),%rdi
call   1030 <upd_img0@plt>
movss  -0xc(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
mov    -0x30(%rbp),%rdi
call   1030 <upd_img0@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<upd_img>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
movss  %xmm5,0x14(%rsp)
movss  %xmm4,0xc(%rsp)
movss  %xmm2,0x10(%rsp)
movss  %xmm1,0x8(%rsp)
movaps %xmm3,%xmm1
call   1030 <upd_img0@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
mov    %rbx,%rdi
call   1030 <upd_img0@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
mov    %r14,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1030 <upd_img0@plt>

LLVM IR (-O0):
define void @upd_img(float %0, float %1, float %2, float %3, float %4, float %5, i32* %6, i32* %7, i32* %8) {
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
store float %0, float* %10
store float %1, float* %11
store float %2, float* %12
store float %3, float* %13
store float %4, float* %14
store float %5, float* %15
store i32* %6, i32** %16
store i32* %7, i32** %17
store i32* %8, i32** %18
%19 = load float, float* %10
%20 = load float, float* %13
%21 = load i32*, i32** %16
%22 = call i32 @upd_img0(float %19, float %20, i32* %21)
%23 = load float, float* %11
%24 = load float, float* %14
%25 = load i32*, i32** %17
%26 = call i32 @upd_img0(float %23, float %24, i32* %25)
%27 = load float, float* %12
%28 = load float, float* %15
%29 = load i32*, i32** %18
%30 = call i32 @upd_img0(float %27, float %28, i32* %29)
ret void
}

LLVM IR (-O2):
define void @upd_img(float %0, float %1, float %2, float %3, float %4, float %5, i32* %6, i32* %7, i32* %8) {
%10 = tail call i32 @upd_img0(float %0, float %3, i32* %6)
%11 = tail call i32 @upd_img0(float %1, float %4, i32* %7)
%12 = tail call i32 @upd_img0(float %2, float %5, i32* %8)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void le32enc(void *pp, uint32_t x) {
  uint8_t *p = (uint8_t *)pp;
  p[0] = x & 0xff;
  p[1] = (x >> 8) & 0xff;
  p[2] = (x >> 16) & 0xff;
  p[3] = (x >> 24) & 0xff;
}


x86 assembly (clang, -O0):
<le32enc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<le32enc>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %ecx,(%rdi)
movzbl %ah,%ecx
mov    %ecx,0x4(%rdi)
mov    %esi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x8(%rdi)
shr    $0x18,%eax
mov    %eax,0xc(%rdi)
ret

LLVM IR (-O0):
define void @le32enc(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32, i32* %4
%9 = and i32 %8, 255
%10 = load i32*, i32** %5
%11 = getelementptr inbounds i32, i32* %10, i64 0
store i32 %9, i32* %11
%12 = load i32, i32* %4
%13 = ashr i32 %12, 8
%14 = and i32 %13, 255
%15 = load i32*, i32** %5
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32 %14, i32* %16
%17 = load i32, i32* %4
%18 = ashr i32 %17, 16
%19 = and i32 %18, 255
%20 = load i32*, i32** %5
%21 = getelementptr inbounds i32, i32* %20, i64 2
store i32 %19, i32* %21
%22 = load i32, i32* %4
%23 = ashr i32 %22, 24
%24 = and i32 %23, 255
%25 = load i32*, i32** %5
%26 = getelementptr inbounds i32, i32* %25, i64 3
store i32 %24, i32* %26
ret void
}

LLVM IR (-O2):
define void @le32enc(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = and i32 %1, 255
store i32 %4, i32* %3
%5 = lshr i32 %1, 8
%6 = and i32 %5, 255
%7 = getelementptr inbounds i8, i8* %0, i64 4
%8 = bitcast i8* %7 to i32*
store i32 %6, i32* %8
%9 = lshr i32 %1, 16
%10 = and i32 %9, 255
%11 = getelementptr inbounds i8, i8* %0, i64 8
%12 = bitcast i8* %11 to i32*
store i32 %10, i32* %12
%13 = lshr i32 %1, 24
%14 = getelementptr inbounds i8, i8* %0, i64 12
%15 = bitcast i8* %14 to i32*
store i32 %13, i32* %15
ret void
}
int scheme_entry() { return 42; }


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

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

LLVM IR (-O0):
define i32 @scheme_entry() {
ret i32 42
}

LLVM IR (-O2):
define i32 @scheme_entry() {
ret i32 42
}
/* Variables and functions */
int __bitmap_parse(char const *, unsigned int, int /*<<< orphan*/,
                   unsigned long *, int);
__attribute__((always_)) int bitmap_parse(const char *buf, unsigned int buflen,
                                          unsigned long *maskp, int nmaskbits) {
  return __bitmap_parse(buf, buflen, 0, maskp, nmaskbits);
}


x86 assembly (clang, -O0):
<bitmap_parse>:
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    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
xor    %edx,%edx
call   1030 <__bitmap_parse@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_parse>:
mov    %ecx,%r8d
mov    %rdx,%rcx
xor    %edx,%edx
jmp    1030 <__bitmap_parse@plt>

LLVM IR (-O0):
define i32 @bitmap_parse(i8* %0, i32 %1, i64* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i64*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i64* %2, i64** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i64*, i64** %7
%12 = load i32, i32* %8
%13 = call i32 @__bitmap_parse(i8* %9, i32 %10, i32 0, i64* %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @bitmap_parse(i8* %0, i32 %1, i64* %2, i32 %3) {
%5 = tail call i32 @__bitmap_parse(i8* %0, i32 %1, i32 0, i64* %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ LOG_DEBUG;
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
void handle_usr1(int signum) {
  syslog(LOG_DEBUG, "Scheduler received SIGUSR1");
}


x86 assembly (clang, -O0):
<handle_usr1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rsi
call   1030 <syslog@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@LOG_DEBUG = global i32 0
@.str = [27 x i8] c"Scheduler received SIGUSR1\00"
define void @handle_usr1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @LOG_DEBUG
%4 = call i32 @syslog(i32 %3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@LOG_DEBUG = global i32 0
@.str = [27 x i8] c"Scheduler received SIGUSR1\00"
define void @handle_usr1(i32 %0) {
%2 = load i32, i32* @LOG_DEBUG
%3 = tail call i32 @syslog(i32 %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct shl_htable {
  int dummy;
};

/* Variables and functions */
int shl_htable_lookup(struct shl_htable *, void const *, size_t, void **);
bool shl_htable_lookup_ulong(struct shl_htable *htable, unsigned long key,
                             unsigned long **out) {
  return shl_htable_lookup(htable, (const void *)&key, (size_t)key,
                           (void **)out);
}


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

x86 assembly (clang, -O2):
<shl_htable_lookup_ulong>:
push   %rax
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rsi,(%rsp)
mov    %rsp,%rsi
call   1030 <shl_htable_lookup@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.shl_htable = type { i32 }
define i32 @shl_htable_lookup_ulong(%struct.shl_htable* %0, i64 %1, i64** %2) {
%4 = alloca %struct.shl_htable*
%5 = alloca i64
%6 = alloca i64**
store %struct.shl_htable* %0, %struct.shl_htable** %4
store i64 %1, i64* %5
store i64** %2, i64*** %6
%7 = load %struct.shl_htable*, %struct.shl_htable** %4
%8 = bitcast i64* %5 to i8*
%9 = load i64, i64* %5
%10 = load i64**, i64*** %6
%11 = bitcast i64** %10 to i8**
%12 = call i32 @shl_htable_lookup(%struct.shl_htable* %7, i8* %8, i64 %9, i8** %11)
ret i32 %12
}

LLVM IR (-O2):
%struct.shl_htable = type { i32 }
define i32 @shl_htable_lookup_ulong(%struct.shl_htable* %0, i64 %1, i64** %2) {
%4 = alloca i64
store i64 %1, i64* %4
%5 = bitcast i64* %4 to i8*
%6 = bitcast i64** %2 to i8**
%7 = call i32 @shl_htable_lookup(%struct.shl_htable* %0, i8* %5, i64 %1, i8** %6)
ret i32 %7
}
/* Variables and functions */
int traverse_directory_recursive(char *, char *,
                                 int (*)(char *, char *, char *), char *);
int traverse_directory(char *root, int (*callback)(char *, char *, char *),
                       char *third_arg) {
  return traverse_directory_recursive(root, root, callback, third_arg);
}


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

x86 assembly (clang, -O2):
<traverse_directory>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
jmp    1030 <traverse_directory_recursive@plt>

LLVM IR (-O0):
define i32 @traverse_directory(i8* %0, i32 (i8*, i8*, i8*)* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32 (i8*, i8*, i8*)*
%6 = alloca i8*
store i8* %0, i8** %4
store i32 (i8*, i8*, i8*)* %1, i32 (i8*, i8*, i8*)** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %4
%9 = load i32 (i8*, i8*, i8*)*, i32 (i8*, i8*, i8*)** %5
%10 = load i8*, i8** %6
%11 = call i32 @traverse_directory_recursive(i8* %7, i8* %8, i32 (i8*, i8*, i8*)* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @traverse_directory(i8* %0, i32 (i8*, i8*, i8*)* %1, i8* %2) {
%4 = tail call i32 @traverse_directory_recursive(i8* %0, i8* %0, i32 (i8*, i8*, i8*)* %1, i8* %2)
ret i32 %4
}
/* Type definitions */
struct timeval {
  unsigned long tv_sec;
  unsigned long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ select(int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/, int /*<<< orphan*/,
                          struct timeval *);
void my_usleep(unsigned long usecs) {
  struct timeval tv;
  tv.tv_sec = usecs / 1000000L;
  tv.tv_usec = usecs % 1000000L;
  (void)select(0, 0, 0, 0, &tv);
}


x86 assembly (clang, -O0):
<my_usleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xf4240,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xf4240,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,-0x10(%rbp)
xor    %ecx,%ecx
lea    -0x18(%rbp),%r8
mov    %ecx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <select@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_usleep>:
sub    $0x18,%rsp
movabs $0x431bde82d7b634db,%rcx
de 1b 43
mov    %rdi,%rax
mul    %rcx
shr    $0x12,%rdx
mov    %rdx,0x8(%rsp)
imul   $0xf4240,%rdx,%rax
sub    %rax,%rdi
mov    %rdi,0x10(%rsp)
lea    0x8(%rsp),%r8
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <select@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define void @my_usleep(i64 %0) {
%2 = alloca i64
%3 = alloca %struct.timeval
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = udiv i64 %4, 1000000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i64 %5, i64* %6
%7 = load i64, i64* %2
%8 = urem i64 %7, 1000000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i64 %8, i64* %9
%10 = call i32 @select(i32 0, i32 0, i32 0, i32 0, %struct.timeval* %3)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define void @my_usleep(i64 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = udiv i64 %0, 1000000
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i64 %4, i64* %5
%6 = urem i64 %0, 1000000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i64 %6, i64* %7
%8 = call i32 @select(i32 0, i32 0, i32 0, i32 0, %struct.timeval* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
char *concat(char *str1, char *str2) {
  char str[200];
  strcpy(str, strdup(str1));
  strcat(str, strdup(str2));
  return strdup(str);
}


x86 assembly (clang, -O0):
<concat>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0xe0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    -0xf0(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    -0xe0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strdup@plt>
mov    -0xe8(%rbp),%rdi
mov    %rax,%rsi
call   1040 <strcat@plt>
lea    -0xe0(%rbp),%rdi
call   1050 <strdup@plt>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concat>:
push   %r14
push   %rbx
sub    $0xc8,%rsp
mov    %rsi,%rbx
call   1050 <strdup@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strdup@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <strcat@plt>
mov    %r14,%rdi
call   1050 <strdup@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @concat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [200 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = call i8* @strdup(i8* %7)
%9 = call i32 @strcpy(i8* %6, i8* %8)
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%11 = load i8*, i8** %4
%12 = call i8* @strdup(i8* %11)
%13 = call i32 @strcat(i8* %10, i8* %12)
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%15 = call i8* @strdup(i8* %14)
ret i8* %15
}

LLVM IR (-O2):
define noalias i8* @concat(i8* nocapture %0, i8* nocapture %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = tail call i8* @strdup(i8* %0)
%6 = call i32 @strcpy(i8* %4, i8* %5)
%7 = call i8* @strdup(i8* %1)
%8 = call i32 @strcat(i8* %4, i8* %7)
%9 = call i8* @strdup(i8* %4)
ret i8* %9
}
/* Type definitions */
struct btf_type {
  int dummy;
};

/* Variables and functions */
scalar_t__ BTF_KIND_UNION;
scalar_t__ btf_kind(struct btf_type const *);
bool btf_is_union(const struct btf_type *t) {
  return btf_kind(t) == BTF_KIND_UNION;
}


x86 assembly (clang, -O0):
<btf_is_union>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <btf_kind@plt>
mov    0x2eac(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btf_is_union>:
push   %rax
call   1030 <btf_kind@plt>
mov    0x2ebb(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.btf_type = type { i32 }
@BTF_KIND_UNION = global i64 0
define i32 @btf_is_union(%struct.btf_type* %0) {
%2 = alloca %struct.btf_type*
store %struct.btf_type* %0, %struct.btf_type** %2
%3 = load %struct.btf_type*, %struct.btf_type** %2
%4 = call i64 @btf_kind(%struct.btf_type* %3)
%5 = load i64, i64* @BTF_KIND_UNION
%6 = icmp eq i64 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.btf_type = type { i32 }
@BTF_KIND_UNION = global i64 0
define i32 @btf_is_union(%struct.btf_type* %0) {
%2 = tail call i64 @btf_kind(%struct.btf_type* %0)
%3 = load i64, i64* @BTF_KIND_UNION
%4 = icmp eq i64 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int sd_bus_new(void **ret) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_new>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    0x2ecf(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_bus_new>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_new(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_new(i8** nocapture readnone %0) {
%2 = load i32, i32* @EINVAL
%3 = sub nsw i32 0, %2
ret i32 %3
}
unsigned long int htonl(unsigned long int x) {
  return ((((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) << 8) |
           ((x & 0x00ff0000U) >> 8) | ((x & 0xff000000U) >> 24)));
}


x86 assembly (clang, -O0):
<htonl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xff,%rax
shl    $0x18,%rax
mov    -0x8(%rbp),%rcx
and    $0xff00,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
and    $0xff0000,%rcx
shr    $0x8,%rcx
or     %rcx,%rax
movabs $0xff000000,%rcx
and    -0x8(%rbp),%rcx
shr    $0x18,%rcx
or     %rcx,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @htonl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 255
%5 = shl i64 %4, 24
%6 = load i64, i64* %2
%7 = and i64 %6, 65280
%8 = shl i64 %7, 8
%9 = or i64 %5, %8
%10 = load i64, i64* %2
%11 = and i64 %10, 16711680
%12 = lshr i64 %11, 8
%13 = or i64 %9, %12
%14 = load i64, i64* %2
%15 = and i64 %14, 4278190080
%16 = lshr i64 %15, 24
%17 = or i64 %13, %16
ret i64 %17
}

LLVM IR (-O2):
define i64 @htonl(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
%4 = zext i32 %3 to i64
ret i64 %4
}
unsigned be_uint24_read(const void *ptr) {
  const unsigned char *ptr8 = (const unsigned char *)ptr;
  return (unsigned)ptr8[2] | (unsigned)ptr8[1] << 8 | (unsigned)ptr8[0] << 16;
}


x86 assembly (clang, -O0):
<be_uint24_read>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%eax
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<be_uint24_read>:
movzwl 0x1(%rdi),%ecx
shl    $0x10,%ecx
bswap  %ecx
movzbl (%rdi),%eax
shl    $0x10,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @be_uint24_read(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 2
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = or i32 %8, %13
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 16
%20 = or i32 %14, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @be_uint24_read(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = or i32 %8, %4
%10 = load i8, i8* %0
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 16
%13 = or i32 %9, %12
ret i32 %13
}
/* Variables and functions */
scalar_t__ fmod(unsigned int, unsigned int);
unsigned int hash_size(unsigned int size, unsigned int tablelen) {
  static double h = 376437.3473946397438347;
  return (unsigned int)fmod(size * h, tablelen);
}


x86 assembly (clang, -O0):
<hash_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0x2efa(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,%edi
mov    -0x8(%rbp),%esi
call   1030 <fmod@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_size>:
mov    %edi,%eax
cvtsi2sd %rax,%xmm0
mulsd  0xee1(%rip),%xmm0
cvttsd2si %xmm0,%rdi
jmp    1030 <fmod@plt>

LLVM IR (-O0):
@hash_size.h = internal global double 0x4116F9D563BB6BA2
define i32 @hash_size(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = uitofp i32 %5 to double
%7 = load double, double* @hash_size.h
%8 = fmul double %6, %7
%9 = fptoui double %8 to i32
%10 = load i32, i32* %4
%11 = call i64 @fmod(i32 %9, i32 %10)
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @hash_size(i32 %0, i32 %1) {
%3 = uitofp i32 %0 to double
%4 = fmul double %3, 0x4116F9D563BB6BA2
%5 = fptoui double %4 to i32
%6 = tail call i64 @fmod(i32 %5, i32 %1)
%7 = trunc i64 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int lis(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int arr[] = {10, 22, 9, 33, 21, 50, 41, 60};
  int n = sizeof(arr) / sizeof(arr[0]);
  printf("Length of lis is %dn", lis(arr, n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x8,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <lis@plt>
mov    %eax,%esi
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
call   1030 <lis@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [8 x i32] [i32 10, i32 22, i32 9, i32 33, i32 21, i32 50, i32 41, i32 60]
@.str = [21 x i8] c"Length of lis is %dn\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [8 x i32]* %2 to i8*
store i32 8, i32* %3
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @lis(i32* %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [8 x i32] [i32 10, i32 22, i32 9, i32 33, i32 21, i32 50, i32 41, i32 60]
@.str = [21 x i8] c"Length of lis is %dn\00"
define i32 @main() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = call i32 @lis(i32* %3, i32 8)
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
struct timeval {
  int /*<<< orphan*/ tv_usec;
};

/* Variables and functions */
double RAND_MAX;
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
unsigned short choose_random_port(void) {
  struct timeval t;
  unsigned short port;
  gettimeofday(&t, NULL);
  srand(t.tv_usec);
  port = 10000 + (int)(55000.0 * (rand() / (RAND_MAX + 1.0)));
  return port;
}


x86 assembly (clang, -O0):
<choose_random_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
movaps %xmm0,%xmm1
movsd  0xea9(%rip),%xmm0
mov    0x2e82(%rip),%rax
addsd  (%rax),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe8a(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    $0x2710,%eax
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<choose_random_port>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    (%rsp),%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
mov    0x2e97(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xea3(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  0xe9f(%rip),%xmm0
cvttsd2si %xmm0,%eax
add    $0x2710,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
@RAND_MAX = global double 0.000000e+00
define zeroext i16 @choose_random_port() {
%1 = alloca %struct.timeval
%2 = alloca i16
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i32 @srand(i32 %5)
%7 = call double (...) @rand()
%8 = load double, double* @RAND_MAX
%9 = fadd double %8, 1.000000e+00
%10 = fdiv double %7, %9
%11 = fmul double 5.500000e+04, %10
%12 = fptosi double %11 to i32
%13 = add nsw i32 10000, %12
%14 = trunc i32 %13 to i16
store i16 %14, i16* %2
%15 = load i16, i16* %2
ret i16 %15
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@RAND_MAX = global double 0.000000e+00
define zeroext i16 @choose_random_port() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = tail call i32 @srand(i32 %5)
%7 = tail call double (...) @rand()
%8 = load double, double* @RAND_MAX
%9 = fadd double %8, 1.000000e+00
%10 = fdiv double %7, %9
%11 = fmul double %10, 5.500000e+04
%12 = fptosi double %11 to i32
%13 = trunc i32 %12 to i16
%14 = add i16 %13, 10000
ret i16 %14
}
/* Variables and functions */
int /*<<< orphan*/ CON_Init();
void CON_SigCont(int signum) { CON_Init(); }


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

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

LLVM IR (-O0):
define void @CON_SigCont(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @CON_Init()
ret void
}

LLVM IR (-O2):
define void @CON_SigCont(i32 %0) {
%2 = tail call i32 (...) @CON_Init()
ret void
}