xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ roadmap_main_exit();
void dl_map_cb(int exit_code) { roadmap_main_exit(); }


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

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

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

LLVM IR (-O2):
define void @dl_map_cb(i32 %0) {
%2 = tail call i32 (...) @roadmap_main_exit()
ret void
}
int hello(int x) {
  x *= 2;
  return x + 45;
}


x86 assembly (clang, -O0):
<hello>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2d,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello>:
lea    (%rdi,%rdi,1),%eax
add    $0x2d,%eax
ret

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

LLVM IR (-O2):
define i32 @hello(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = add nsw i32 %2, 45
ret i32 %3
}
int xtensa_uimm8x2(v)
int v;
{ return (v & 1) == 0 && (v >= 0 && v <= 510); }


x86 assembly (clang, -O0):
<xtensa_uimm8x2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x1,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
jne    113d <xtensa_uimm8x2+0x3d>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1137 <xtensa_uimm8x2+0x37>
cmpl   $0x1fe,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtensa_uimm8x2>:
test   $0x1,%dil
sete   %al
cmp    $0x1ff,%edi
setb   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @xtensa_uimm8x2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp sle i32 %10, 510
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ false, %6 ], [ %11, %9 ]
br label %14
14: ; preds = %12, %1
%15 = phi i1 [ false, %1 ], [ %13, %12 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @xtensa_uimm8x2(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
%4 = icmp ult i32 %0, 511
%5 = and i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ test_init(int, char **);
int /*<<< orphan*/ test_msg(char *, char *, int);
int main(int argc, char **argv) {
  test_init(argc, argv);
  test_msg("SKIP: %s:%d: "
           "Inotify not supported."
           "\n",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/"
           "zdtm/static/inotify_system.c",
           388);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_init@plt>
lea    0xeb7(%rip),%rdi
lea    0xed5(%rip),%rsi
mov    $0x184,%edx
call   1040 <test_msg@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <test_init@plt>
lea    0xed3(%rip),%rdi
lea    0xef1(%rip),%rsi
mov    $0x184,%edx
call   1040 <test_msg@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"SKIP: %s:%d: Inotify not supported.\0A\00"
@.str.1 = [157 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/zdtm/static/inotify_system.c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @test_init(i32 %6, i8** %7)
%9 = call i32 @test_msg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str.1, i64 0, i64 0), i32 388)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"SKIP: %s:%d: Inotify not supported.\0A\00"
@.str.1 = [157 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/zdtm/static/inotify_system.c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @test_init(i32 %0, i8** %1)
%4 = tail call i32 @test_msg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str.1, i64 0, i64 0), i32 388)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
char *system_error(void) {
  static char lpMsgBuf[200];
  strcpy(lpMsgBuf, strerror(errno));
  return lpMsgBuf;
}


x86 assembly (clang, -O0):
<system_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    %eax,%esi
lea    0x2f05(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2ef9(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<system_error>:
push   %rbx
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0x2f0a(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@system_error.lpMsgBuf = internal global [200 x i8] zeroinitializer
@errno = global i32 0
define i8* @system_error() {
%1 = load i32, i32* @errno
%2 = call i32 @strerror(i32 %1)
%3 = call i32 @strcpy(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @system_error.lpMsgBuf, i64 0, i64 0), i32 %2)
ret i8* getelementptr inbounds ([200 x i8], [200 x i8]* @system_error.lpMsgBuf, i64 0, i64 0)
}

LLVM IR (-O2):
@system_error.lpMsgBuf = internal global [200 x i8] zeroinitializer
@errno = global i32 0
define i8* @system_error() {
%1 = load i32, i32* @errno
%2 = tail call i32 @strerror(i32 %1)
%3 = tail call i32 @strcpy(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @system_error.lpMsgBuf, i64 0, i64 0), i32 %2)
ret i8* getelementptr inbounds ([200 x i8], [200 x i8]* @system_error.lpMsgBuf, i64 0, i64 0)
}
/* Variables and functions */
int strlen(char *);
int verificaNome(char *nome) {
  int tamNome = strlen(nome);
  if (nome == NULL || tamNome == 0 || tamNome >= 80)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<verificaNome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1147 <verificaNome+0x37>
cmpl   $0x0,-0x14(%rbp)
je     1147 <verificaNome+0x37>
cmpl   $0x50,-0x14(%rbp)
jl     1153 <verificaNome+0x43>
movl   $0x0,-0x4(%rbp)
jmp    115a <verificaNome+0x4a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verificaNome>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rbx,%rbx
setne  %cl
test   %eax,%eax
setne  %dl
and    %cl,%dl
cmp    $0x50,%eax
setl   %al
and    %dl,%al
movzbl %al,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @verificaNome(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp ne i8* %0, null
%4 = icmp ne i32 %2, 0
%5 = select i1 %3, i1 %4, i1 false
%6 = icmp slt i32 %2, 80
%7 = select i1 %5, i1 %6, i1 false
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ mutt_error(char *);
int /*<<< orphan*/ mutt_exit(int);
int /*<<< orphan*/ sleep(int);
void *safe_malloc(size_t siz) {
  void *p;
  if (siz == 0)
    return 0;
  if ((p = (void *)malloc(siz)) == 0) {
    mutt_error("Out of memory!");
    sleep(1);
    mutt_exit(1);
  }
  return (p);
}


x86 assembly (clang, -O0):
<safe_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1164 <safe_malloc+0x24>
movq   $0x0,-0x8(%rbp)
jmp    11a3 <safe_malloc+0x63>
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    119b <safe_malloc+0x5b>
lea    0xe7e(%rip),%rdi
call   1060 <mutt_error@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1030 <mutt_exit@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_malloc>:
push   %rbx
test   %rdi,%rdi
je     1175 <safe_malloc+0x35>
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1177 <safe_malloc+0x37>
lea    0xea6(%rip),%rdi
call   1060 <mutt_error@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
call   1030 <mutt_exit@plt>
jmp    1177 <safe_malloc+0x37>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Out of memory!\00"
define i8* @safe_malloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* null, i8** %2
br label %19
8: ; preds = %1
%9 = load i64, i64* %3
%10 = call i64 @malloc(i64 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %4
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = call i32 @mutt_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @sleep(i32 1)
%16 = call i32 @mutt_exit(i32 1)
br label %17
17: ; preds = %13, %8
%18 = load i8*, i8** %4
store i8* %18, i8** %2
br label %19
19: ; preds = %17, %7
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [15 x i8] c"Out of memory!\00"
define i8* @safe_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i64 @malloc(i64 %0)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = tail call i32 @mutt_error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @sleep(i32 1)
%10 = tail call i32 @mutt_exit(i32 1)
br label %11
11: ; preds = %3, %7, %1
%12 = phi i8* [ null, %1 ], [ %5, %7 ], [ %5, %3 ]
ret i8* %12
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void error(char *msg) {
  fprintf(stderr, "libayemu: lh5dec.c: %s\n", msg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"libayemu: lh5dec.c: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"libayemu: lh5dec.c: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Type definitions */
struct comp {
  int dummy;
};
struct BrzFetchReject_ {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SEND_ACKDOWN(int);
int /*<<< orphan*/ SEND_DATAOFF_DELAYED(int, int);
void BrzFetchReject_reqdown(struct comp *comp, int port) {
  struct BrzFetchReject_ *c = (struct BrzFetchReject_ *)comp;
  SEND_ACKDOWN(port);
  if (port == 1) {
    SEND_DATAOFF_DELAYED(2, 1);
  }
}


x86 assembly (clang, -O0):
<BrzFetchReject_reqdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <SEND_ACKDOWN@plt>
cmpl   $0x1,-0xc(%rbp)
jne    1158 <BrzFetchReject_reqdown+0x38>
mov    $0x2,%edi
mov    $0x1,%esi
call   1040 <SEND_DATAOFF_DELAYED@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BrzFetchReject_reqdown>:
push   %rbx
mov    %esi,%ebx
mov    %esi,%edi
call   1030 <SEND_ACKDOWN@plt>
cmp    $0x1,%ebx
jne    113f <BrzFetchReject_reqdown+0x1f>
mov    $0x2,%edi
mov    $0x1,%esi
pop    %rbx
jmp    1040 <SEND_DATAOFF_DELAYED@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.comp = type { i32 }
%struct.BrzFetchReject_ = type { i32 }
define void @BrzFetchReject_reqdown(%struct.comp* %0, i32 %1) {
%3 = alloca %struct.comp*
%4 = alloca i32
%5 = alloca %struct.BrzFetchReject_*
store %struct.comp* %0, %struct.comp** %3
store i32 %1, i32* %4
%6 = load %struct.comp*, %struct.comp** %3
%7 = bitcast %struct.comp* %6 to %struct.BrzFetchReject_*
store %struct.BrzFetchReject_* %7, %struct.BrzFetchReject_** %5
%8 = load i32, i32* %4
%9 = call i32 @SEND_ACKDOWN(i32 %8)
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @SEND_DATAOFF_DELAYED(i32 2, i32 1)
br label %14
14: ; preds = %12, %2
ret void
}

LLVM IR (-O2):
%struct.comp = type { i32 }
define void @BrzFetchReject_reqdown(%struct.comp* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @SEND_ACKDOWN(i32 %1)
%4 = icmp eq i32 %1, 1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @SEND_DATAOFF_DELAYED(i32 2, i32 1)
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printw(char *);
void ion_cmd_traceroute(char *cmd) { printw("\n\rtraceroute command\n\r\n\r"); }


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

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

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

LLVM IR (-O2):
@.str = [25 x i8] c"\0A\0Dtraceroute command\0A\0D\0A\0D\00"
define void @ion_cmd_traceroute(i8* nocapture readnone %0) {
%2 = tail call i32 @printw(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}
void swap(int *A, int i, int j) {
  int tmp = A[i];
  A[i] = A[j];
  A[j] = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

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

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ merge(int, int, int);
void mergesort(int low, int high) {
  int mid;
  if (low < high) {
    mid = (low + high) / 2;
#pragma omp task
    { mergesort(low, mid); }
#pragma omp task
    { mergesort(mid + 1, high); }
    merge(low, mid, high);
  }
}


x86 assembly (clang, -O0):
<mergesort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1172 <mergesort+0x52>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <mergesort@plt>
mov    -0xc(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
call   1040 <mergesort@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <merge@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergesort>:
cmp    %esi,%edi
jge    1160 <mergesort+0x40>
push   %r15
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%r15d
lea    (%r14,%r15,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%esi
call   1040 <mergesort@plt>
lea    0x1(%rbx),%edi
mov    %r14d,%esi
call   1040 <mergesort@plt>
mov    %r15d,%edi
mov    %ebx,%esi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <merge@plt>
ret

LLVM IR (-O0):
define void @mergesort(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %23
9: ; preds = %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = add nsw i32 %10, %11
%13 = sdiv i32 %12, 2
store i32 %13, i32* %5
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = load i32, i32* %5
%21 = load i32, i32* %4
%22 = call i32 @merge(i32 %19, i32 %20, i32 %21)
br label %23
23: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
define void @mergesort(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %5, label %4
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = add nsw i32 %1, %0
%7 = sdiv i32 %6, 2
tail call void @mergesort(i32 %0, i32 %7)
%8 = add nsw i32 %7, 1
tail call void @mergesort(i32 %8, i32 %1)
%9 = tail call i32 @merge(i32 %0, i32 %7, i32 %1)
br label %4
}
int write_entry(int fd, char *buf, int len) {
  int ret;
  do {
  } while (0);
  ret = write(fd, buf, len);
  if (ret != len) {
    printf("ERROR: %s: write returned %i\n", __func__, ret);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<write_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
jmp    1137 <write_entry+0x17>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     117b <write_entry+0x5b>
mov    -0x18(%rbp),%edx
lea    0xe9f(%rip),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1182 <write_entry+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_entry>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <write@plt>
cmp    %ebp,%eax
je     114e <write_entry+0x2e>
lea    0xec7(%rip),%rdi
lea    0xede(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"ERROR: %s: write returned %i\0A\00"
@__func__.write_entry = [12 x i8] c"write_entry\00"
define i32 @write_entry(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
br label %9
9: ; preds = %3
br label %10
10: ; preds = %9
%11 = load i32, i32* %5
%12 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %11, i8* %12, i32 %13)
store i32 %14, i32* %8
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %21
18: ; preds = %10
%19 = load i32, i32* %8
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.write_entry, i64 0, i64 0), i32 %19)
store i32 -1, i32* %4
br label %22
21: ; preds = %10
store i32 0, i32* %4
br label %22
22: ; preds = %21, %18
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
@.str = [30 x i8] c"ERROR: %s: write returned %i\0A\00"
@__func__.write_entry = [12 x i8] c"write_entry\00"
define i32 @write_entry(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i32, ...)*)(i32 %0, i8* %1, i32 %2)
%5 = icmp eq i32 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.write_entry, i64 0, i64 0), i32 %4)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ -1, %6 ], [ 0, %3 ]
ret i32 %9
}
/* Variables and functions */
scalar_t__ random_rand();
float random_float(const float max) {
  return (max * (((float)random_rand()) / (float)(unsigned int)0xFFFFFFFF));
}


x86 assembly (clang, -O0):
<random_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <random_rand@plt>
movss  -0x8(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
movss  0xec0(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_float>:
push   %rax
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1030 <random_rand@plt>
cvtsi2ss %rax,%xmm1
mulss  0xed5(%rip),%xmm1
movss  0x4(%rsp),%xmm0
mulss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @random_float(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 (...) @random_rand()
%5 = sitofp i64 %4 to float
%6 = fdiv float %5, 0x41F0000000000000
%7 = fmul float %3, %6
ret float %7
}

LLVM IR (-O2):
define float @random_float(float %0) {
%2 = tail call i64 (...) @random_rand()
%3 = sitofp i64 %2 to float
%4 = fmul float %3, 0x3DF0000000000000
%5 = fmul float %4, %0
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ __rcu_read_lock_bh();
void rcu_read_lock_bh(void) {
  __rcu_read_lock_bh();
  (void)0;
  do {
  } while (0);
}


x86 assembly (clang, -O0):
<rcu_read_lock_bh>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <__rcu_read_lock_bh@plt>
jmp    1120 <rcu_read_lock_bh+0x10>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @rcu_read_lock_bh() {
%1 = call i32 (...) @__rcu_read_lock_bh()
br label %2
2: ; preds = %0
br label %3
3: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @rcu_read_lock_bh() {
%1 = tail call i32 (...) @__rcu_read_lock_bh()
ret void
}
/* Type definitions */
struct UPnPService {
  int dummy;
};

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


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

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

LLVM IR (-O0):
%struct.UPnPService = type { i32 }
@.str = [68 x i8] c"RND Invoke Response: RenderingControl/SetVolumeDB[ErrorCode:%d]()\0D\0A\00"
define void @RNDResponseSink_RenderingControl_SetVolumeDB(%struct.UPnPService* %0, i32 %1, i8* %2) {
%4 = alloca %struct.UPnPService*
%5 = alloca i32
%6 = alloca i8*
store %struct.UPnPService* %0, %struct.UPnPService** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
%struct.UPnPService = type { i32 }
@.str = [68 x i8] c"RND Invoke Response: RenderingControl/SetVolumeDB[ErrorCode:%d]()\0D\0A\00"
define void @RNDResponseSink_RenderingControl_SetVolumeDB(%struct.UPnPService* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ test_case();
int main() {
  int tc;
  scanf("%d", &tc);
  while (tc--)
    test_case();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     115f <main+0x3f>
mov    $0x0,%al
call   1030 <test_case@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x4(%rsp)
jb     114e <main+0x2e>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <test_case@plt>
subl   $0x1,0x4(%rsp)
jae    1140 <main+0x20>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* %2
%6 = add nsw i32 %5, -1
store i32 %6, i32* %2
%7 = icmp ne i32 %5, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = call i32 (...) @test_case()
br label %4
10: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%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 = add nsw i32 %4, -1
store i32 %5, i32* %1
%6 = icmp eq i32 %4, 0
br i1 %6, label %12, label %7
7: ; preds = %0, %7
%8 = call i32 (...) @test_case()
%9 = load i32, i32* %1
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %7
12: ; preds = %7, %0
ret i32 0
}
unsigned quickLog2(unsigned power_of_two) {
  unsigned res = 0;
  while (power_of_two >>= 1) {
    res++;
  }
  return res;
}


x86 assembly (clang, -O0):
<quickLog2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     112e <quickLog2+0x2e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <quickLog2+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickLog2>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     111c <quickLog2+0x1c>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <quickLog2+0x10>
ret

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

LLVM IR (-O2):
define i32 @quickLog2(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 4
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ put8(unsigned char);
void shld_reg32_reg32_imm8(unsigned long reg1, unsigned long reg2,
                           unsigned char imm8) {
  put8(0x0F);
  put8(0xA4);
  put8(0xC0 | (reg2 << 3) | reg1);
  put8(imm8);
}


x86 assembly (clang, -O0):
<shld_reg32_reg32_imm8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    $0xf,%edi
call   1030 <put8@plt>
mov    $0xa4,%edi
call   1030 <put8@plt>
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
or     $0xc0,%rax
or     -0x8(%rbp),%rax
movzbl %al,%edi
call   1030 <put8@plt>
movzbl -0x11(%rbp),%edi
call   1030 <put8@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shld_reg32_reg32_imm8>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    $0xf,%edi
call   1030 <put8@plt>
mov    $0xa4,%edi
call   1030 <put8@plt>
shl    $0x3,%ebx
or     %ebx,%ebp
or     $0xc0,%bpl
movzbl %bpl,%edi
call   1030 <put8@plt>
mov    %r14d,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @shld_reg32_reg32_imm8(i64 %0, i64 %1, i8 zeroext %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8 %2, i8* %6
%7 = call i32 @put8(i8 zeroext 15)
%8 = call i32 @put8(i8 zeroext -92)
%9 = load i64, i64* %5
%10 = shl i64 %9, 3
%11 = or i64 192, %10
%12 = load i64, i64* %4
%13 = or i64 %11, %12
%14 = trunc i64 %13 to i8
%15 = call i32 @put8(i8 zeroext %14)
%16 = load i8, i8* %6
%17 = call i32 @put8(i8 zeroext %16)
ret void
}

LLVM IR (-O2):
define void @shld_reg32_reg32_imm8(i64 %0, i64 %1, i8 zeroext %2) {
%4 = tail call i32 @put8(i8 zeroext 15)
%5 = tail call i32 @put8(i8 zeroext -92)
%6 = shl i64 %1, 3
%7 = or i64 %6, %0
%8 = trunc i64 %7 to i8
%9 = or i8 %8, -64
%10 = tail call i32 @put8(i8 zeroext %9)
%11 = tail call i32 @put8(i8 zeroext %2)
ret void
}
/* Variables and functions */
int pigpio_command(int, int, unsigned int, int /*<<< orphan*/, int);
int wave_delete(int pi, unsigned wave_id) {
  return pigpio_command(pi, 50, wave_id, 0, 1);
}


x86 assembly (clang, -O0):
<wave_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0x32,%esi
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1030 <pigpio_command@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wave_delete>:
mov    %esi,%edx
mov    $0x32,%esi
xor    %ecx,%ecx
mov    $0x1,%r8d
jmp    1030 <pigpio_command@plt>

LLVM IR (-O0):
define i32 @wave_delete(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @pigpio_command(i32 %5, i32 50, i32 %6, i32 0, i32 1)
ret i32 %7
}

LLVM IR (-O2):
define i32 @wave_delete(i32 %0, i32 %1) {
%3 = tail call i32 @pigpio_command(i32 %0, i32 50, i32 %1, i32 0, i32 1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ get_extension(char *);
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
void set_extension(char *outname, char *suffix) {
  (void)strcpy(get_extension(outname), suffix);
  return;
}


x86 assembly (clang, -O0):
<set_extension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <get_extension@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_extension>:
push   %rbx
mov    %rsi,%rbx
call   1040 <get_extension@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

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

LLVM IR (-O2):
define void @set_extension(i8* %0, i8* %1) {
%3 = tail call i32 @get_extension(i8* %0)
%4 = tail call i32 @strcpy(i32 %3, i8* %1)
ret void
}
int check_bounds(int n, int max, int min) {
  if (n <= min)
    return min;
  else if (n >= max)
    return max;
  else
    return n;
}


x86 assembly (clang, -O0):
<check_bounds>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1124 <check_bounds+0x24>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <check_bounds+0x41>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     113b <check_bounds+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <check_bounds+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_bounds>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
cmp    %edx,%edi
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @check_bounds(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %2
%5 = icmp slt i32 %0, %1
%6 = select i1 %5, i32 %0, i32 %1
%7 = select i1 %4, i32 %6, i32 %2
ret i32 %7
}
/* Variables and functions */
float __ocml_remainder_f32(float, float);
float remainderf(float x, float y) { return __ocml_remainder_f32(x, y); }


x86 assembly (clang, -O0):
<remainderf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <__ocml_remainder_f32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remainderf>:
jmp    1030 <__ocml_remainder_f32@plt>

LLVM IR (-O0):
define float @remainderf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call float @__ocml_remainder_f32(float %5, float %6)
ret float %7
}

LLVM IR (-O2):
define float @remainderf(float %0, float %1) {
%3 = tail call float @__ocml_remainder_f32(float %0, float %1)
ret float %3
}
char *config_disp_bool(int v) { return (v > 0) ? "on" : "off"; }


x86 assembly (clang, -O0):
<config_disp_bool>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xef2(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovg  %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_disp_bool>:
test   %edi,%edi
lea    0xef7(%rip),%rcx
lea    0xef3(%rip),%rax
cmovg  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"on\00"
@.str.1 = [4 x i8] c"off\00"
define i8* @config_disp_bool(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [3 x i8] c"on\00"
@.str.1 = [4 x i8] c"off\00"
define i8* @config_disp_bool(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ jmp_buf;

/* Variables and functions */
int /*<<< orphan*/ longjmp(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setjmp(int /*<<< orphan*/);
int main() {
  printf("init\n");
  jmp_buf env;
  if (!setjmp(env)) {
    printf("first\n");
    longjmp(env, 1);
  } else {
    printf("second\n");
  }
  printf("end\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <setjmp@plt>
cmp    $0x0,%eax
jne    116e <main+0x3e>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1050 <longjmp@plt>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
call   1040 <setjmp@plt>
test   %eax,%eax
je     1162 <main+0x32>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%esi
call   1050 <longjmp@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"init\0A\00"
@.str.1 = [7 x i8] c"first\0A\00"
@.str.2 = [8 x i8] c"second\0A\00"
@.str.3 = [5 x i8] c"end\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
%4 = call i32 @setjmp(i32 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = call i32 @longjmp(i32 %8, i32 1)
unreachable
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [5 x i8] c"init\00"
@str.4 = [6 x i8] c"first\00"
@str.5 = [7 x i8] c"second\00"
@str.6 = [4 x i8] c"end\00"
define i32 @main() {
%1 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%2 = call i32 @setjmp(i32 undef)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.4, i64 0, i64 0))
%6 = call i32 @longjmp(i32 undef, i32 1)
unreachable
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                          unsigned int);
void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size) {
  memcpy(*b, src, size);
  (*b) += size;
}


x86 assembly (clang, -O0):
<bytestream_put_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    %edx,%edx
shl    $0x2,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytestream_put_buffer>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rdi,%r14
mov    (%rdi),%rdi
call   1030 <memcpy@plt>
mov    %ebx,%eax
shl    $0x2,%rax
add    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @bytestream_put_buffer(i32** %0, i32* %1, i32 %2) {
%4 = alloca i32**
%5 = alloca i32*
%6 = alloca i32
store i32** %0, i32*** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32**, i32*** %4
%8 = load i32*, i32** %7
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = call i32 @memcpy(i32* %8, i32* %9, i32 %10)
%12 = load i32, i32* %6
%13 = load i32**, i32*** %4
%14 = load i32*, i32** %13
%15 = zext i32 %12 to i64
%16 = getelementptr inbounds i32, i32* %14, i64 %15
store i32* %16, i32** %13
ret void
}

LLVM IR (-O2):
define void @bytestream_put_buffer(i32** nocapture %0, i32* %1, i32 %2) {
%4 = load i32*, i32** %0
%5 = tail call i32 @memcpy(i32* %4, i32* %1, i32 %2)
%6 = load i32*, i32** %0
%7 = zext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %6, i64 %7
store i32* %8, i32** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_hello();
int main(int argc, char **argv) {
  print_hello();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @print_hello()
ret i32 0
}
void reverse_aux(char s[], int left, int right) {
  char tmp;
  if (left >= right)
    return;
  tmp = s[left];
  s[left] = s[right];
  s[right] = tmp;
  reverse_aux(s, left + 1, right - 1);
}


x86 assembly (clang, -O0):
<reverse_aux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1133 <reverse_aux+0x23>
jmp    117a <reverse_aux+0x6a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
call   1030 <reverse_aux@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse_aux>:
cmp    %edx,%esi
jge    1131 <reverse_aux+0x31>
movslq %edx,%rax
movslq %esi,%rcx
add    $0xffffffffffffffff,%rax
xchg   %ax,%ax
movzbl (%rdi,%rcx,1),%esi
movzbl 0x1(%rdi,%rax,1),%edx
mov    %dl,(%rdi,%rcx,1)
mov    %sil,0x1(%rdi,%rax,1)
add    $0x1,%rcx
lea    -0x1(%rax),%rdx
cmp    %rax,%rcx
mov    %rdx,%rax
jl     1110 <reverse_aux+0x10>
ret

LLVM IR (-O0):
define void @reverse_aux(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp sge i32 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %3
br label %37
12: ; preds = %3
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
store i8 %17, i8* %7
%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 = load i8*, i8** %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 %22, i8* %26
%27 = load i8, i8* %7
%28 = load i8*, i8** %4
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8 %27, i8* %31
%32 = load i8*, i8** %4
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
%35 = load i32, i32* %6
%36 = sub nsw i32 %35, 1
br label %37
37: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @reverse_aux(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = sext i32 %2 to i64
%7 = sext i32 %1 to i64
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ %7, %5 ], [ %15, %8 ]
%10 = phi i64 [ %6, %5 ], [ %16, %8 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %9
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 %10
%14 = load i8, i8* %13
store i8 %14, i8* %11
store i8 %12, i8* %13
%15 = add nsw i64 %9, 1
%16 = add nsw i64 %10, -1
%17 = icmp slt i64 %15, %16
br i1 %17, label %8, label %18
18: ; preds = %8, %3
ret void
}